title: Can't configure nginx as a proxy for tomcat with context path
body: <p>Having Tomcat with application accessible on <a href="http://localhost:8080/application" rel="nofollow">http://localhost:8080/application</a>.</p>
  
  <p>Want to have access to this application via url <a href="http://app.ru" rel="nofollow">http://app.ru</a>. So here's nginx proxy config:</p>
  
  <pre><code>server {
      server_name app.ru .app.ru;
      listen 80;
      location / {
          proxy_pass http://localhost:8080/application;
          proxy_set_header Host $host;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      }
  }
  </code></pre>
  
  <p>When moving to <a href="http://app.ru" rel="nofollow">http://app.ru</a>, it return 302 redirect to <a href="http://app.ru/application" rel="nofollow">http://app.ru/application</a></p>
  
  <p>How to fix it?</p>