title: nginx proxy to tomcat hiding address
body: <p>I am trying to set nginx as a reverse proxy to a Tomcat (which runs on the same box).</p>
  
  <p>The nginx server runs on port 9001 and i would like to proxy any requests to tomcat (which runs on port 8080), but i would like to prevent the user seeing tomcat's actual address in his/her browser bar.</p>
  
  <p>I have the below nginx server configuration:</p>
  
  <pre><code>server {
      listen       9001;
      server_name  myHostname.com;
  
      location / {
          proxy_pass http://myHostname.com:8080;
  
           proxy_redirect off;
           proxy_set_header X-Forwarded-Host $host;
           proxy_set_header X-Forwarded-Server $host;
           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      }
  }
  </code></pre>
  
  <p>When i try to access <a href="http://myHostname:9001" rel="nofollow">http://myHostname:9001</a> from my browser it redirects me to <a href="http://myHostname:8080" rel="nofollow">http://myHostname:8080</a>. I would like to be able to access <a href="http://myHostname:9001" rel="nofollow">http://myHostname:9001</a> and view the web app that is deployed in Tomcat but without my browser's bar to reveal Tomcat's port.</p>
  
  <p>Is that possible using nginx ?</p>
  
  <p>Thanks in advance</p>