Opened 12 years ago

Closed 12 years ago

#174 closed enhancement (invalid)

Problem with redirection when subdomain string is the same as the upstream name

Reported by: Jean-Marc Dormoy Owned by: somebody
Priority: minor Milestone:
Component: nginx-core Version: 1.3.x
Keywords: Cc:
uname -a: Linux ns 2.6.32-6-pve #1 SMP Mon Jan 23 08:27:52 CET 2012 x86_64 GNU/Linux
nginx -V: # nginx -V
nginx version: nginx/0.7.65
TLS SNI support enabled
configure arguments: --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/body --http-proxy-temp-path=/var/lib/nginx/proxy --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --with-debug --with-http_stub_status_module --with-http_flv_module --with-http_ssl_module --with-http_dav_module --with-http_gzip_static_module --with-http_realip_module --with-mail --with-mail_ssl_module --with-ipv6 --add-module=/build/buildd/nginx-0.7.65/modules/nginx-upstream-fair

Description

Hi,
I have now the following configuration:
in nginx.conf

upstream blogupstream{

server 10.10.0.220:80;

}

in conf.d/blog.conf
server {

listen 80;
server_name blog.XXX.com;
location / {

proxy_set_header Host $host;
proxy_set_header X-Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $server_protocol;

proxy_pass http://blogupstream;

}

}
[ got also a ssl section]

This configuration is now working fine BUT, I use to have the following

in nginx.conf : upstream blog
in blog.conf : proxy_pass http://blog

the blog is running with Wordpress, and with this initial set up, there was some strange redirections on subdirectories like:

https://blog.XXX.com/wp-admin/post.php?post=439&action=edit

redirected to :

https://blog.XXX.com/wp-admin/.XXX.com/wp-admin/post.php?post=439&action=edit

I initially thought it was a problem with wordpress, but it turned to work correctly when I changed the upstream string from "blog" to "blogupstream"

Don't know if this is a bug or a known issue (shame on me if I didn't read correctly all the documentation).

Best

JM Dormoy

Change History (1)

comment:1 by Maxim Dounin, 12 years ago

Resolution: invalid
Status: newclosed

This problem was fixed in nginx 0.9.5, http://nginx.org/en/CHANGES:

    *) Bugfix: in a default "proxy_redirect" directive if "proxy_pass"
       directive has no URI part.
Note: See TracTickets for help on using tickets.