<div dir="ltr"><div style="font-size:12.8px">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.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Simple Scenario:</div><div style="font-size:12.8px">```</div><div style="font-size:12.8px"><span class="gmail-m_293435187912923600gmail-m_228109673564041500gmail-m_3793336017561535958gmail-Apple-tab-span" style="white-space:pre-wrap">             </span>location / {</div><div style="font-size:12.8px"><div><span class="gmail-m_293435187912923600gmail-m_228109673564041500gmail-m_3793336017561535958gmail-Apple-tab-span" style="white-space:pre-wrap">         </span><span style="white-space:pre-wrap">        </span>proxy_pass <a href="http://rve.org.uk/utils/echo-nocache.cgi/freg/" target="_blank">http://rve.org.uk/u<wbr>tils/echo-nocache.cgi/freg/</a>;</div><div><span class="gmail-m_293435187912923600gmail-m_228109673564041500gmail-m_3793336017561535958gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>}<br></div></div><div style="font-size:12.8px">```</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Upstream scenario:</div><div style="font-size:12.8px">```</div><div style="font-size:12.8px"><div><span class="gmail-m_293435187912923600gmail-m_228109673564041500gmail-m_3793336017561535958gmail-Apple-tab-span" style="white-space:pre-wrap">    </span>upstream app_server {</div><div><span class="gmail-m_293435187912923600gmail-m_228109673564041500gmail-m_3793336017561535958gmail-Apple-tab-span" style="white-space:pre-wrap">              </span>server <a href="http://rve.org.uk/" target="_blank">rve.org.uk:80</a>;</div><div><span class="gmail-m_293435187912923600gmail-m_228109673564041500gmail-m_3793336017561535958gmail-Apple-tab-span" style="white-space:pre-wrap">    </span>}</div></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><span style="white-space:pre-wrap">     </span>server {</div><div style="font-size:12.8px">[...]</div><div style="font-size:12.8px"><div><span class="gmail-m_293435187912923600gmail-m_228109673564041500gmail-m_3793336017561535958gmail-Apple-tab-span" style="white-space:pre-wrap">              </span>location / {</div><div><span class="gmail-m_293435187912923600gmail-m_228109673564041500gmail-m_3793336017561535958gmail-Apple-tab-span" style="white-space:pre-wrap">               </span><span style="white-space:pre-wrap">        </span>proxy_pass <a href="http://app_server/utils/echo-nocache.cgi/freg/" target="_blank">http://app_server/u<wbr>tils/echo-nocache.cgi/freg/</a>;<br></div><div><span class="gmail-m_293435187912923600gmail-m_228109673564041500gmail-m_3793336017561535958gmail-Apple-tab-span" style="white-space:pre-wrap">              </span>}<br></div></div><div style="font-size:12.8px">```</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Following a rejected defect report (see <a href="https://trac.nginx.org/nginx/ticket/1155#comment:1" target="_blank">https://trac.nginx.org/ng<wbr>inx/ticket/1155#comment:1</a> for full nginx.conf) I have tried using:</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><div><span class="gmail-m_293435187912923600gmail-m_228109673564041500gmail-m_3793336017561535958gmail-Apple-tab-span" style="white-space:pre-wrap">              </span>proxy_set_header Host $proxy_host;</div><div><span class="gmail-m_293435187912923600gmail-m_228109673564041500gmail-m_3793336017561535958gmail-Apple-tab-span" style="white-space:pre-wrap">         </span>proxy_set_header Host $http_host;<br></div><div><span class="gmail-m_293435187912923600gmail-m_228109673564041500gmail-m_3793336017561535958gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>proxy_set_header Host $host; </div><div><span class="gmail-m_293435187912923600gmail-m_228109673564041500gmail-m_3793336017561535958gmail-Apple-tab-span" style="white-space:pre-wrap">             </span>proxy_set_header Host <a href="http://rev.org.uk/" target="_blank">rev.org.uk</a>;</div></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">None of them work in the upstream scenario, only the first, $proxy_host works for the simple scenario.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I have tested this on both nginx for Windows and the default Docker Hub image (nginx/1.11.6), and had identical results.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Can anyone please tell me what I am doing wrong?</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Thanks -</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Francis.</div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div style="text-align:center"><font face="garamond, serif"><i>Multitasking creates a dopamine-addiction feedback loop, effectively rewarding the brain for losing focus and for constantly searching for external stimulation</i> - Daniel Levitin, The Organised Mind</font></div></div></div></div></div>
</div>