So, as you suggest, here comes the answer:
When you make a request to your server ( nginx + upstream ) as GET, then $request_time result with a normal and acceptable value. This is because your upstream server is not involved in it, and even if it does, it does it correctly.
Problems arise when you execute a POST request. According to the nginx doc value, the value of the $request_time variable (available only during logging) will be calculated when all data has been sent and the connection has been closed (by all upstream and proxy servers). And only then the information is added to the journal.
So how to check if everything is correct? First, make a GET request to your server and view the log file. Note how long it takes to end the call and add the log information to the file - this should be a real value. Then do a POST request to your server and view the log file again. Here you will probably see that the magazine does not come at all or after a very long period.
What does it mean? Check your nginx conf and your upstream conf, because somewhere there might be a place where the connection is not closed and just hang in the air. These connections can be resumed after the time of your OS or an upstream server, but in the end it can cause some problems besides just the weird value of $request_time .
source share