Reverse proxy redirection issue

Francis Daly francis at daoine.org
Tue Sep 21 12:23:45 UTC 2021


On Mon, Sep 20, 2021 at 05:20:55PM -0300, Daniel Armando Rodriguez wrote:
> El 2021-09-20 13:49, Francis Daly escribió:
> > On Sun, Sep 19, 2021 at 10:08:08PM -0300, Daniel Armando Rodriguez
> > wrote:

Hi there,

> > > curl -i https://4.DOMAIN.edu.ar
> > > 
> > > Returns a redirect to https://4.DOMAIN.edu.ar
> > 
> > And that is a redirect loop, which is not what you want.
> > 
> > When you request https://4.DOMAIN.edu.ar, that should get to nginx,
> > which should make a http request to INTERNAL_IP and return the response.

> > What response do you get if you start on the nginx server and run the
> > command
> > 
> >     curl -v -H Host:4.DOMAIN.edu.ar http://INTERNAL-IP/


> This is the output
> 
> # curl -v -H Host:4.DOMAIN.edu.ar http://INTERNAL-IP/

<snip>

> > GET / HTTP/1.1
> > Host:4.DOMAIN.edu.ar

> < HTTP/1.1 301 Moved Permanently
> < Location: https://1.DOMAIN.edu.ar/

This indicates that the internal web server is returning a redirect to
https://1, when you ask it for http://4.

Is there any chance that that internal web server is not yet configured to
believe that it is 4, and it instead redirects to its default name of 1?

> However, the same target machine hosts other services (each one with its own
> subdomain: 1, 2 & 3) that also go through the proxy. And they work as
> expected. Just to compare, this is the output.
> 
> # curl -v -H Host:2.DOMAIN.edu.ar http://INTERNAL-IP/

> > GET / HTTP/1.1
> > Host:2.DOMAIN.edu.ar

> < HTTP/1.1 200 OK

(And, presumably, the correct content from 2.)


That might also explain why the first test failed, then started working
-- perhaps the internal web server reloaded its configuration and it
started behaving as expected?

(And maybe it works for 4 now too, if the config reloaded over night?)

Cheers,

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list