title: Nginx missing trailing slash returns 301
body: <p>I have the following config:</p>
  
  <pre><code>server {
    listen       80;
    server_name  localhost;
  
    location  /app {
      root   /usr/share/nginx/html;
      index  index.html index.htm;
      try_files $uri $uri/ /app/index.html?$args;
    }
  
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
      root   /usr/share/nginx/html;
    }
  }
  </code></pre>
  
  <p>When navigating to <code>http://localhost:8000/app/</code> all works as expected but when removing the trailing slash (<code>http://localhost:8000/app</code>) nginx returns 301 status response and I am being redirected to <code>http://localhost/app</code>.</p>
  
  <p>How can I make nginx work with both <code>http://localhost:8000/app/</code> and <code>http://localhost:8000/app</code> (with and without trailing slash).</p>