<div dir="ltr"><div><div class="gmail-h7" tabindex="-1" style="outline:none;font-size:medium"><div class="gmail-Bk" style="margin-bottom:0px;border-right:0px;border-bottom:0px;border-left:0px;border-radius:0px;width:1690px;float:none"><div class="gmail-G3 gmail-G2" style="padding-top:0px;border-right:0px;border-bottom:0px rgb(216,216,216);border-left:0px;border-top-color:rgb(216,216,216);border-radius:0px;margin-bottom:0px;margin-left:0px;margin-right:0px"><div id="gmail-:1xn"><div class="gmail-adn gmail-ads" style="padding-bottom:20px;padding-left:8px"><div class="gmail-gs" style="margin-left:44px"><div id="gmail-:2bm" class="gmail-ii gmail-gt" style="font-size:12.8px;margin-bottom:0px;margin-left:0px;padding-bottom:5px"><div id="gmail-:2bl" class="gmail-a3s gmail-aXjCH gmail-m1610a44aa4e04bca"><div dir="ltr"><div style="font-size:12.8px">Hello Everyone, </div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I'm trying to get nginx server configured as a reverse proxy serving requests to few application servers upstream.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Server {</div><div style="font-size:12.8px">server_name <a href="http://app1.company.domain.com/" target="_blank">app1.company.<wbr>domain.com</a>;</div><div style="font-size:12.8px">listen 80;</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">location / {</div><div style="font-size:12.8px">    proxy_pass http://appserver1:app1port/;</div><div style="font-size:12.8px">    proxy_pass_request_body on;</div><div style="font-size:12.8px">    proxy_intercept_errors on;</div><div style="font-size:12.8px">    error_page 301 302 307 = @handle_redirect;</div><div style="font-size:12.8px">   }</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">location @handle_redirect {</div><div style="font-size:12.8px">    set $saved_redirect_location '$upstream_http_location';</div><div style="font-size:12.8px">    proxy_pass $saved_redirect_location;</div><div style="font-size:12.8px">   }</div><div style="font-size:12.8px">I'm having two challenges with this.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">1) This doesn't work with the firewalls. I can get to it only if I open appserver1 to accept everyone on that app1port. I tried replacing the headers but none of them work.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">2) This configuration works when I turn off the firewall, but the address in the address bar gets rewritten to http://appserver1:app1port which is a a dealbreaker as we definitely don't want to have the upstream server appear in the address bar.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Also these servers (nginx server and the upstream app server) aren't connected to the same DNS as the client. So neither of these servers can resolve <a href="http://app1.company.domain.com/" target="_blank">app1.company.domain.<wbr>com</a></div><div style="font-size:12.8px">I'm not sure where the problem lies, and would really appreciate any pointers. </div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Thanks</div></div><div class="gmail-yj6qo"></div><div class="gmail-adL"></div></div></div><div class="gmail-hi"></div></div><div class="gmail-ajx"></div></div><div class="gmail-gA gmail-gt gmail-acV" style="font-size:12.8px;border-bottom-left-radius:0px;border-bottom-right-radius:0px;border-top:none;background:transparent"><div class="gmail-gB gmail-xu"><div class="gmail-ip gmail-iq" style="margin-right:5px;padding-left:0px"></div></div></div></div></div></div></div><div class="gmail-h7 gmail-ie" tabindex="-1" style="outline:none;font-size:medium"><div class="gmail-Bk" style="margin-bottom:0px;border-right:0px;border-bottom:0px;border-left:0px;border-radius:0px;width:1690px;float:none"><div class="gmail-G3 gmail-G2" style="padding-top:0px;border-right:0px;border-bottom:0px rgb(216,216,216);border-left:0px;border-top-color:rgb(216,216,216);border-radius:0px;margin-bottom:0px;margin-left:0px;margin-right:0px"><div id="gmail-:1y5"><div class="gmail-adn gmail-ads" style="padding-bottom:20px;padding-left:8px"><div class="gmail-aju"><div class="gmail-aCi"></div></div></div></div></div></div></div></div></div>