HTTP 403 when using proxy_pass with upstream server block

Francis Norton francis.norton at gmail.com
Tue Dec 13 17:15:53 UTC 2016


When I reverse proxy to a public echo service, I can make this work using
the server name directly, but I get an HTTP 403 if I use an upstream server
block pointing to the same domain.

Simple Scenario:
```
location / {
proxy_pass http://rve.org.uk/utils/echo-nocache.cgi/freg/;
}
```

Upstream scenario:
```
upstream app_server {
server rve.org.uk:80 <http://rve.org.uk/>;
}

server {
[...]
location / {
proxy_pass http://app_server/utils/echo-nocache.cgi/freg/;
}
```

Following a rejected defect report (see https://trac.nginx.org/ng
inx/ticket/1155#comment:1 for full nginx.conf) I have tried using:

proxy_set_header Host $proxy_host;
proxy_set_header Host $http_host;
proxy_set_header Host $host;
proxy_set_header Host rev.org.uk;

None of them work in the upstream scenario, only the first, $proxy_host
works for the simple scenario.

I have tested this on both nginx for Windows and the default Docker Hub
image (nginx/1.11.6), and had identical results.

Can anyone please tell me what I am doing wrong?

Thanks -

Francis.
-- 
*Multitasking creates a dopamine-addiction feedback loop, effectively
rewarding the brain for losing focus and for constantly searching for
external stimulation* - Daniel Levitin, The Organised Mind
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20161213/6d997d72/attachment.html>


More information about the nginx mailing list