title: Server receives POST request twice from Nginx
body: <p>We have a nginx server acting as a reverse proxy between the client and server. </p>
  
  <p>Whenever the server returns a 500 we actually see that the request is being sent to the server twice from the nginx logs:</p>
  
  <pre><code>173.38.209.10 - - [26/Jan/2018:15:15:36 +0000] "POST /api/customer/add HTTP/1.1" 500 115 "http://apiwebsite.com" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
  173.38.209.10 - - [26/Jan/2018:15:15:36 +0000] "POST /api/customer/add HTTP/1.1" 500 157 "http://apiwebsite.com" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
  </code></pre>
  
  <p>This API is only called twice if the first response is a <code>500</code>.</p>
  
  <p>If I bypass the nginx proxy and call the server directly, then it's only called once.</p>
  
  <p>What's more strange is after further testing we found out this only happens in our corporate network. If i use my home network to connect to the proxy, then there's no retry even in case of a <code>500</code> response.</p>
  
  <p>Anway, here's my nginx configuration:</p>
  
  <pre><code>    server {
      listen 80 default_server;
      listen [::]:80 default_server ipv6only=on;
  
      root /usr/share/nginx/html;
      index index.html index.htm;
  
      # Make site accessible from http://localhost/
      server_name localhost;
  
      location / {
          # First attempt to serve request as file, then
          # as directory, then fall back to displaying a 404.
          proxy_set_header   X-Forwarded-For $remote_addr;
          proxy_set_header   Host $http_host;
          proxy_pass         "http://127.0.0.1:3000";
          # Uncomment to enable naxsi on this location
          # include /etc/nginx/naxsi.rules
      }
      location /api/customer/ {
                  proxy_pass "http://127.0.0.1:8080/";
          }
  }
  </code></pre>
  
  <p>Is there anything suspicious which is causing this behaviour?</p>
  
  <p>Thanks</p>