title: Prevent nginx from adding extra slashes
body: <p>I wanted my nginx configuration to redirect all incomings requests from</p>
  <p><code>myServer.com/myApplication/doSomething</code> -&gt; <code>myServer.com:7080/doSomething</code></p>
  <p><code>myServer.com/myApplication/doSomethingElse</code> -&gt; <code>myServer.com:7080/doSomethingElse</code></p>
  <p>I came up with the following solution after reading <a href="https://serverfault.com/questions/536576/nginx-how-do-i-forward-an-http-request-to-another-port">this</a> post:</p>
  <pre><code>location /myApplication{
    proxy_pass http://127.0.0.1:7080/;
  }
  </code></pre>
  <p>No I encounter this weird behavior, that when I test everything locally on the server it seems to work fine, but when I call it from another machine nginx seems to add an extra slash to the path. The curl request I use is this one:</p>
  <pre><code>curl --location --request POST 'myServer.com/myApplication/doSomething'
  </code></pre>
  <p>The error I get from my application has the follwing error message:</p>
  <pre><code>{
      &quot;timestamp&quot;: &quot;2021-06-07T12:33:41.666+0000&quot;,
      &quot;status&quot;: 500,
      &quot;error&quot;: &quot;Internal Server Error&quot;,
      &quot;message&quot;: &quot;The request was rejected because the URL contained a potentially malicious String \&quot;//\&quot;&quot;,
      &quot;path&quot;: &quot;//doSomething&quot;
  }
  </code></pre>
  <p>The error message says, that there is a problem with the extra slashes, but the curl request does not contain double slashes. When testing it locally, where everything works, I use the following request:</p>
  <pre><code>curl -X POST localhost:7080/doSomething
  </code></pre>
  <p>Thanks in advance.</p>