An HTTP request header is part of an HTTP request message that contains specific parameters for a server. You can configure rules for origin HTTP request headers to pass specific parameters to your origin server. Edge Security Acceleration (ESA) supports adding, modifying, and deleting these rules.
Introduction
When a client requests a resource, the request first reaches ESA. If the request is a cache miss on the ESA POP, the ESA POP sends an origin request that contains the outgoing HTTP request header to the origin server to retrieve data. You can adjust the outgoing HTTP request header as needed. The ESA POP returns the retrieved resource to the client.
Notes
If a single rule for modifying outgoing request headers contains multiple operations, the operations are executed in sequence. If multiple operations target the same request header, the last operation overwrites the previous ones.
Example 1
The client request contains the header
test:123.The rule adds the header
test:321.
If a user request hits the rule, the test:123 header in the original request is overwritten by test:321.
Example 2
The client request contains the header
test:123.The rule adds the header
test:321, and then another operation is configured to delete the headertest.
If a user request hits the rule, the test:123 header in the original request is deleted.
Procedure
After you add a rule, when a user requests a resource, ESA matches and executes rules sequentially based on the rule execution priority.
In the ESA console, choose Websites, and click the target site in the Website column.
In the navigation pane on the left, choose .
Click the Modify Request Header tab and choose ESA to Origin. Click Create Rule and enter a Rule Name.
In the If requests match... section, set the conditions that the client request must match. For more information, see Composition of a rule expression.
In the Modify Request Header section, select the Type and Operation, and then enter the Request Header Name and Request Header Value.
NoteIf a single rule for modifying outgoing request headers contains multiple operations, the operations are executed in sequence. If multiple operations target the same request header, the last operation overwrites the previous ones.
Operation
Type
Description
Example
Add
Static
Adds the specified request header to the back-to-origin request.
If the client request already contains a request header with the same name, the new request header overwrites the existing one.
To add a request header named
x-codewith the valuekey1, specify the following parameters:Request Header Name:
x-codeRequest Header Value:
key1
Dynamic
The request header value can be set to an expression.
To add a request header named
True-Client-IPwith the valueip.srcto record the originating IP address of the client, specify the following parameters:Request Header Name:
True-Client-IPRequest Header Value:
ip.src
Change
Static
Modifies the value of the specified request header in the origin request.
To change the value of the request header named
x-codein the back-to-origin request tokey2, specify the following parameters:Request Header Name:
x-codeRequest Header Value:
key2
Dynamic
The request header value can be set to an expression.
To modify the request header named
True-Client-IPin the back-to-origin request and change its value toip.src, which is the originating IP address of the client, specify the following parameters:Request Header Name:
True-Client-IPRequest Header Value:
ip.src
Delete
Deletes all parameter values that match the Request Header Name from the back-to-origin request, regardless of whether there are duplicate request header parameters.
To delete the request header named
x-code, set Request Header Name tox-code.NoteDo not configure a Request Header Name that starts with
ali-orAli-.You can configure multiple values for Request Header Value. Separate the values with commas (
,).The delete operation works the same way in static and dynamic modes.
The modify operation is used to modify an existing request header. This operation is applied only if a request header with the specified name is present in the original request.
Click OK.
Dynamic expression examples
Example 1
Add a request header to record the originating IP address of the client.
Request Header Name:
True-Client-IPRequest Header Value:
ip.src
Example 2
Add a request header to record the country code that corresponds to the client's IP address.
Request Header Name:
IP-Country-CodeRequest Header Value:
ip.geoip.country
Example 2
Add a request header to record the province code that corresponds to the client's IP address.
Request Header Name:
IP-Province-CodeRequest Header Value:
ip.src.subdivision_1_iso_code
References
Rule-related features vary in execution priority, rule behavior, and configuration scope. For more information, see How ESA rules take effect.