proxy_pass redirect for address without trailing slash disregards Host port
Francis Daly
francis at daoine.org
Fri Aug 30 19:45:14 UTC 2019
On Sat, Aug 24, 2019 at 11:17:34AM +0200, Nuno Gonçalves wrote:
Hi there,
> That's not correct, the server is taking the Host domain part from the
> client Host header. It's just not taking the port part.
>
> This inconsistency is why I believe it's a bug.
Before "absolute_redirect", I would have called it a bug too.
Now I just consider it "a feature".
I think that nginx has never used the port from the Host header (or from
the request line, if present) in its redirects.
I think that it might be useful for nginx to be able to use that -- as in
"a redirect could optionally use exactly the host:port provided in the
string from the request that nginx used to choose the server{}" -- but
I guess that no-one who cared enough about it provided a justification
and a patch.
And now, "absolute_redirect off;" probably makes it unnecessary.
If you know that you want to use exactly one "unusual" port in the url,
I think that it is possible to fake it using server_name and the various
*_in_redirect directives. But that is not a general solution.
Cheers,
f
--
Francis Daly francis at daoine.org
More information about the nginx
mailing list