title: Problem with nginx location and proxy_pass
body: <p>I have a rule in my nginx.conf that does not work and I have no idea why. According to the documentation it should work. Part of the config looks like this.</p>
  
  <p>The first rule on port 8100 works and redirects the call <strong><a href="http://example.com/api/domains" rel="nofollow noreferrer">http://example.com/api/domains</a></strong> to <strong><a href="https://localhost:8181/oan/resources/domains" rel="nofollow noreferrer">https://localhost:8181/oan/resources/domains</a></strong></p>
  
  <pre><code># Working
  server {
      listen                  8100 default_server;
      server_name             example.com;
      proxy_set_header        X-Real-IP $remote_addr;
      proxy_set_header        Host      $http_host;
      root                    /var/www/html/example;
  
      location /api {
         proxy_pass https://localhost:8181/oan/resources; break;
      }
  
      # For ReactJS to handle routes
      location / {
         if (!-e $request_filename) {
            rewrite ^(.*)$ / break;
         }
      }
  }
  
  # Not working
  server {
      listen                  8200;
      server_name             api.example.com;
      proxy_set_header        X-Real-IP $remote_addr;
      proxy_set_header        Host      $http_host;
  
      location / {
         proxy_pass https://localhost:8181/oan/resources; break;
      }
  }
  </code></pre>
  
  <p>The last call to port 8200: <strong><a href="http://api.example.com:8200/domains" rel="nofollow noreferrer">http://api.example.com:8200/domains</a></strong> SHOULD redirect to: <strong><a href="https://localhost:8181/oan/resources/domains" rel="nofollow noreferrer">https://localhost:8181/oan/resources/domains</a></strong> but does NOT do that.</p>
  
  <p>What is wrong with this config and how can I get the last rule on port 8200 do the correct stuff, always redirect to <strong><a href="https://localhost:8181/oan/resources/" rel="nofollow noreferrer">https://localhost:8181/oan/resources/</a>$uri</strong></p>