Reverse proxy bug due to configuration scope issues

There was a change recent that add set_header to the following:

location / {
        proxy_pass http://06.plumtree.co.nz/;
        **proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;**
}

However for wordpress and SSL proxying this does not work. Gives the infinite loop problem.

I have the following in /home/user-data/www/DOMAIN.conf

proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;

So that works with just:

location / {
        proxy_pass http://06.plumtree.co.nz/;
}

or this works without anything in /home/user-data/www/DOMAIN.conf

location / {
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Host $http_host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_pass http://06.plumtree.co.nz/;
}

Please adjust the automatic cron script that regenerating this to include the extra configuration required.

The details need to be in the same configuration scope. Otherwise it doesn’t work.

Would you create a pull request on GitHub with these changes? I think it makes sense.

Done.

This topic was automatically closed after 61 days. New replies are no longer allowed.