All Products
Document Center

:What do I do if a persistent connection times out?

Last Updated:May 25, 2023

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, the server 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 approximately 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.

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


  1. Log on to the WAF 3.0 console. In the top navigation bar, select the resource group and the region in which the WAF instance is deployed. The region can be Chinese Mainland or Outside Chinese Mainland.

  2. In the left-side navigation pane, click Website Configuration.

  3. On the CNAME Record tab, find the domain name whose access configurations you want to modify and click Edit in the Actions column.

  4. In the Configure Forwarding Rule step, click Other Advanced Settings and change the values of the Read Connection Timeout Period and Write Connection Timeout Period parameters.

    A read connection timeout period or write connection period can range from 1 to 3,600 seconds. The default read connection timeout period or write connection period is 120 seconds.