I managed to create a reverse proxy server that receives data through POST requests from clients and redirects them to the NodeJS server for further processing and storage.
Now I would like the nginx reverse proxy to return an empty 200 OK response for all these requests BEFORE sending it to the nodeServer host. therefore, clients will immediately receive a response without waiting for the backend server to finish working. if I use "return 202;" inside the location directive, nginx reverse proxy responds immediately, but never redirects the request to the NodeJS server.
can this be done with nginx? perhaps with LUA? Any help would be greatly appreciated.
this is my current configuration:
server {
listen 80;
server_name test.proxy.com;
root /home/http/root;
location ~* /([0-5]|Heartbeat|Tracking) {
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';
}
}