Last update:2026-04-29 12:01:09
CDNetworks provides an HTTP header management feature that gives you flexible control over the HTTP request and response headers exchanged between CDN nodes, clients, and your origin server. This allows you to customize header behavior to optimize security, caching, and other aspects of your content delivery.
Based on your needs, you can add, replace, or remove HTTP headers in four directions: CDN to Origin Request, CDN to Client Response, CDN Receives Origin Response, and CDN Receives Client Request.
Apply to
Specify the effective range this header rule should apply to. You can choose from these options:
| Parameter | Description |
|---|---|
| All Requests | Apply to all types of requests under the domain. |
| Only Homepage | Apply only to requests in the root directory format, such as http://domain/ or https://domain/. |
| Specific File Type | Apply to specific file types. Select common file types from the list or define custom file types. Separate multiple types with a semicolon ;, e.g., jpg;png. |
| Specific URL Path | Apply to content requests for designated URIs, excluding the scheme. Separate multiple URIs with line breaks. For example, for http://www.test.com/browse/index.html, please enter /browse/index.html. |
| Specific Directory | Apply to content requests under certain directories, e.g., /file/abc/ for all content under http://domain/file/abc/*.Note: Directories must start and end with / and can only include letters, numbers and some special characters (underscore, hyphen, percent sign, period). Separate multiple directories with line breaks. |
| URL Pattern (Regex) | You can also choose to directly enter a regular expression, not required to start with /. The platform will automatically prefix the URL with ^https?://[^/]/, e.g., .*.jpg$, indicating that requests for JPG files across all domains associated with this rule will match this policy. |
Advanced Scope Conditions
You can further refine the rule’s effective scope using Advanced Scope Conditions. This will intersect with the basic Apply to scope for precise control. Select one or more parameters to form an AND relationship with the basic Apply to to target specific requests or responses.
| Parameter | Description |
|---|---|
| User Agent (UA) | Match User Agent strings using regex, e.g., ^Mozilla/4\.0$ for User Agents starting and ending with Mozilla/4.0. |
| Exclude User-Agent | Exclude User Agents using regex. |
| Status Code | Matches specific HTTP status codes. Separate multiple codes with ;, e.g., 200;404. |
| Exclude Status Code | Exclude specific HTTP status codes. |
| Exclude File Type | Exclude certain file types. Separate multiple types with ;. |
| Exclude Custom File Type | Exclude custom file types as needed. Separate multiple types with ;. |
| Exclude Directory | Exclude specific directory paths. Paths must start and end with /. Separate multiple directories with ;. |
| Access-Control-Allow-Methods | Match HTTP request methods. Separate multiple methods with ;, e.g., GET;POST. |
| Exclude Request Method | Exclude specific HTTP request methods. |
| Request Header | Match request headers and their values. Separate with a space, e.g., Range bytes=[0-9]{9,} for Range headers with values starting with bytes= followed by at least 9 digits. |
| Exclude Request Header | Exclude specific request headers and values, using the same format as Request Header. |
| Response Header | Match response headers and their values. Separate with a space, e.g., cache-control max-age= for cache-control headers with values containing max-age=. |
| Exclude Response Header | Exclude specific response headers and values, using the same format as Response Header. |
| Exclude URL (Regex) | Exclude URLs using regex, e.g., .*\.jpg$. |
Action
Choose one of the following:
Select or Customize an HTTP Header
Configure the HTTP Header Value
Note:
For Add and Replace operations, only one HTTP header can be configured per rule. For Remove operations, you can specify multiple headers.
Select the Header Control Direction
Choose the direction where the rule should apply. There are four options: Request to Origin, Response to Client, Response from Origin, and Request from Client.
Priority
Set the rule’s priority. The higher the number, the greater the priority for matching and execution. Rules with higher priority will be executed first under identical matching conditions.
After configuring, click Confirm, then select Next Step to submit your settings. To minimize any potential disruptions to your production environment, we strongly recommend conducting a Pre-deploy test in a staging environment. This crucial step ensures that your configurations are accurate before they go live. Once you have verified the accuracy of the settings, click Deploy Now to implement them in the production environment. The configurations typically become effective within 3-5 minutes. For comprehensive guidance on pre-deployment testing and to verify the effectiveness of your configurations, please consult the tutorial Deploy the Configurations to Staging Environment for Validation.