Close Connection

The close connection action is used to immediately terminate client connections without returning any response content. This action is typically used in conjunction with conditional rules to quickly block requests when specific conditions are met.

Please note: Frequent use of this action may affect normal users’ access experience. Please ensure that the close connection rules are configured reasonably.

Use Cases

  • Security Protection: Block malicious requests or attack traffic
  • Access Control: Restrict access to specific URIs or IP addresses
  • Resource Protection: Prevent unauthorized access to sensitive resources
  • Traffic Management: Quickly reject some requests when the system is overloaded

Configuration

Select the “Close Connection” action in page rules, which typically needs to be used with conditions:

  1. Set trigger conditions (such as specific URI, IP address, User-Agent, etc.)
  2. Select “Close Connection” as the execution action
  3. Save and apply the rule

Behavioral Characteristics

  • Immediate Effect: The connection will be closed immediately without processing subsequent request content
  • No Response Returned: The client will not receive any HTTP response
  • Equivalent Status Code: This action has the same effect as returning a 444 status code
  • Resource Saving: Avoids generating and transmitting response content, saving server resources

Example Demonstration

$ curl http://test.com -v
*   Trying 127.0.0.1:80...
* Connected to test.com (127.0.0.1) port 80 (#0)
> GET / HTTP/1.1
> Host: test.com
> User-Agent: curl/7.76.1
> Accept: */*
>
* Empty reply from server
* Closing connection 0
curl: (52) Empty reply from server

As you can see:

  • Connection established successfully
  • Connection closed immediately after request was sent
  • Client triggered “Empty reply from server” error
  • No HTTP response content was received