My server is node.js and I use nginx as a reverse proxy.
Now I have to do a time-consuming https request, but I always get the 504 Gateway Time-out error. and nginx/error.log says:
"upstream timed out"
So I change nginx conf to:
proxy_read_timeout 600;
proxy_connect_timeout 600;
client_max_body_size 32M;
client_body_buffer_size 512k;
proxy_send_timeout 600;
proxy_buffers 32 4k;
This time there will be no 504 error, but it turn to be 502 error, and nginx/error says:
"upstream prematurely closed connection"
And I find the error will just appear after I start the request for 120s.
My request process will sure take more than 120s, because it will do a time-consuming mysql query.
So I do not know how to get rid of the 502 error.