Issue with auto subdomain nd trailing slash

shumisha nginx-forum at nginx.us
Fri Feb 22 13:39:46 UTC 2013


Hi Francis,

Thanks a lot for your message, I think I got things under control thanks to
you!

You're right, there's indeed a 301 thrown by nginx from
http://subdomain.xxxx.net/admin to http://xxxx.net/admin/
(as shown by the curl output).

I had tried server_name_in_redirect to off before, to no avail, but I tried
again, just in case. I looked up the documentation again, and I realized:

- it's probably not active on my version, as nginx still uses the first
server in the server_name directive regardless of the directive value.
However, it's a valid config value
- but that got me thinking and I simply switched the orders of server, so
that it reads:

server_name *.xxxx.net xxxx.net;

So now the automatic redirect still happens (I think it should be
configurabe, maybe it is) but by placing the *.xxxx.net server first in the
server_name directive, the sub domain is preserved and the redirect now
happens with the correct host.

Thanks again for your help :)

Rgds

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,236469,236477#msg-236477



More information about the nginx mailing list