Redirecting without canonicalizing the port

Yang Zhang yanghatespam at
Fri Dec 17 03:05:56 MSK 2010

This seems to happen for all redirects (e.g. rewrites), but if it
makes any difference, the particular redirect I'm interested in is

  location /foo { alias /.../foo; }

Requests to /foo get redirected to /foo/ (but with the wrong port
number, as described below).

On Thu, Dec 16, 2010 at 3:58 PM, Yang Zhang <yanghatespam at> wrote:
> Can I redirect to a URL that uses the port number in the request, as
> opposed to the port specified in `listen`? (so as to work with
> proxies/tunnels)
> E.g., if I have `listen 444` and have a tunnel so that my client is
> surfing http://localhost:4444, I don't want my redirects to send the
> client to http://localhost:444, which is currently the case - I want
> the port number to be reflected back, not "canonicalized."
> Thanks in advance for any hints.

More information about the nginx mailing list