Port redirect in URL

Francis Daly francis at daoine.org
Thu Apr 21 14:55:36 UTC 2016


On Thu, Apr 21, 2016 at 10:41:24AM -0400, Jim Ohlstein wrote:
> On 4/21/16 10:17 AM, Igor Sysoev wrote:
> >>On 21 Apr 2016, at 17:09, Jim Ohlstein <jim at ohlste.in> wrote:

Hi there,

> >>>   location / {
> >>>       proxy_pass http://10.0.250.37:8000;
> >>>       proxy_set_header   Host  $host;

> >proxy_redirect  https://lists.mydomain.com:8000/  /;
> 
> Same result. I believe I had tried it already. To make certain I
> wasn't seeing a cached response I checked with curl:
> 
> curl -I https://lists.mydomain.com

> Location: http://lists.mydomain.com:8000/mailman/listinfo

If that is the line that comes back from the proxy_pass'ed server to
nginx, then you want

  proxy_redirect http://lists.mydomain.com:8000/ /;

(where the first argument to proxy_redirect is the string that you want
to replace with the second argument, allowing for scheme://host to be
added later.)

If you can do without the "proxy_set_header Host" line, then you can
possibly do without proxy_redirect altogether (as in: use "proxy_redirect
default;" implicitly).

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list