The 504 error is that the server is acting as a gateway or proxy to complete the client's request, because the background code may have accessed another server. I am accessing a remote database here, so in order to complete the request, the server accesses the server of this remote database. , but did not get a timely response. Because it cooperated with Nginx, the timeout set for a request was 60s. Within this time period, there was still no timely response and a 504 error was returned. I set the timeout for connecting to the remote database to be within 60 seconds, so that it can return error information, and the exception will be caught by my background, and then return my own defined error format.
The 504 error is that the server is acting as a gateway or proxy to complete the client's request, because the background code may have accessed another server. I am accessing a remote database here, so in order to complete the request, the server accesses the server of this remote database. , but did not get a timely response. Because it cooperated with Nginx, the timeout set for a request was 60s. Within this time period, there was still no timely response and a 504 error was returned. I set the timeout for connecting to the remote database to be within 60 seconds, so that it can return error information, and the exception will be caught by my background, and then return my own defined error format.
The server returns 504 indicating that it did not respond to the request. There may be an unexpected error
Check the business logic and return a response to the front end for each situation, preferably with error information