title: nginx reverse proxy - Respond with 200 ok BEFORE passing to backend server
body: <p>i've successfully managed to set up a reverse proxy which receives data via POST requests from clients and forwards them to a NodeJS server for further processing and storing.</p>
  
  <p>now i would like the nginx reverse proxy to return a 200 OK blank response for all of these requests BEFORE forwarding to the nodeJS server. so the clients will receive the response immediately without the need to wait for the backend server to finish the processing.
  if i use "return 202;" inside the location directive, the nginx reverse proxy does respond immediately, but never forwards the request to the NodeJS server.</p>
  
  <p>can this be achieved with nginx? perhaps with LUA?
  any help would be much appreciated.</p>
  
  <p>this is my current configuration:</p>
  
  <pre><code>server {
      listen 80;
      server_name test.proxy.com;
      root /home/http/root;
  
      location ~* /([0-5]|Heartbeat|Tracking) {
          # return 202;
          proxy_pass http://20.10.10.6:8080;
          proxy_http_version 1.1;
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection 'upgrade';
          proxy_set_header Host $host;
          proxy_cache_bypass $http_upgrade;
          more_set_headers 'Access-Control-Allow-Headers: X-Requested-With' 'Access-Control-Allow-Methods: POST, GET, OPTIONS' 'Access-Control-Allow-Origin: http://cors.domain.com';
      }
  }
  </code></pre>