This topic describes how to resolve the issue that a persistent connection between a client and a server times out. The server is protected by Web Application Firewall (WAF).

Problem description

In some business scenarios, a server requires more than 60 seconds to process a client request. Before the server returns the response, it does not exchange data with the client.

For example, you upload an Excel file on a web page for the server to process. The server requires about 3 minutes to process the data and does not exchange data with the client over HTTP or TCP within 120 seconds. In this case, WAF returns a 504 Gateway Timeout error to the client and terminates the connection.

WAF does not maintain a persistent connection that lasts more than 120 seconds without data exchange.

Solution

  • If you use a WAF exclusive cluster to protect your website, you can configure a connection timeout period. A custom timeout period can range from 120 seconds to 3,600 seconds. You can separately configure connection timeout periods for both read and write connections. For more information, see Create an exclusive cluster.
  • If you use a WAF shared cluster to protect your website, the connection timeout period cannot be modified.