Reverse proxy redirection issue

Francis Daly francis at daoine.org
Mon Sep 20 16:49:26 UTC 2021


On Sun, Sep 19, 2021 at 10:08:08PM -0300, Daniel Armando Rodriguez wrote:
> El 2021-09-19 04:00, Francis Daly escribió:

Hi there,

> Today I added a new domain, and the issue showed up again.
> 
> curl -i http://4.DOMAIN.edu.ar
> 
> Returns a redirect to https://4.DOMAIN.edu.ar

Ok, so that much is doing what is wanted.

> But
> 
> 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.

> server {
>     listen 443 ssl http2;
> 
>     server_name 4.DOMAIN.edu.ar;

>     location / {
>        proxy_http_version  1.1;
>        #For Websockets and keepalive connections
>        proxy_set_header Upgrade           $http_upgrade;
>        proxy_set_header Connection        "upgrade";
>        #required when using Websockets
>        proxy_set_header Host              $host;
...
>        proxy_pass http://INTERNAL-IP/;
>     }

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/

? I'm not sure if the Connection header will make a difference here;
it is possible that some of the X- headers are specially handled by the
internal server; and maybe adding --http1.1 to the curl command line
will make a difference too.

The aim is to see how the internal server responds, to see if there is
an nginx-side config that can be made to make the end-user experience
more useful.



It is possible that the internal server logs, or the nginx debug log,
could give more detail; but the "curl" command is probably relatively
quick to run and interpret.

Cheers,

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list