﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	uname	nginx_version
174	Problem with redirection when subdomain string is the same as the upstream name	Jean-Marc Dormoy	somebody	"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
"	enhancement	closed	minor		nginx-core	1.3.x	invalid			Linux ns 2.6.32-6-pve #1 SMP Mon Jan 23 08:27:52 CET 2012 x86_64 GNU/Linux	"# 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"
