HTTP 403 when using proxy_pass with upstream server block

Francis Norton at
Tue Dec 13 17:05:20 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 / {

Upstream scenario:
upstream app_server {
server <>;

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

Following a rejected defect report (see
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;

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 -

*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: <>

More information about the nginx mailing list