Issue with auto subdomain nd trailing slash

Francis Daly francis at
Fri Feb 22 12:56:51 UTC 2013

On Fri, Feb 22, 2013 at 06:27:27AM -0500, shumisha wrote:

> I am running into a weird issue, after having configured nginx 0.7.67 (comes
> with debian 6) for serving PHP pages, with automatic subdomains.
> It works fine for the most part, but when requesting a url that correspond
> to an actual folder, but without a trailing slash, the subdomain recognition
> fails.

What is probably happening is that when you ask for /dir, you get a http
redirect to /dir/. That redirect must include the full url, including
the hostname. And nginx has to choose which hostname to use. And it
doesn't choose the one that you want it to choose.

What is the output of

  curl -i

? I guess it will show You then separately
request, and therefore shouldn't be surprised
that the subdomain recognition fails, because in this request there is
no subdomain.

Possibly setting server_name_in_redirect
( to "off" will work for
you? The docs say that default is off, but I think that may have been
different in the 0.7 series.

Francis Daly        francis at

More information about the nginx mailing list