variables
Introduction
The variables of the rule engine allow you to dynamically extract and process data within request. These variables can not only store static values but also use for specific fields or information in the request, the value of which may change when processing each request. For example: the
http.request.host
variable, which can extract the hostname
in each HTTP request. This capability enables the rule engine to handle more complex business logic.Content
Name | Type | Description | Example |
http.request.scheme | String | Client request protocol | http https |
http.request.zone | String | Site name | example.com |
http.request.zoneid | String | Site ID | zone-2c2r77pc3796 |
http.request.host | String | Hostname in the client request URI | www.example.com |
http.request.full_uri | String | Full URI of the client request (not including #fragment) | https://www.example.org/articles/index?section=539061&expand=comments |
http.request.method | String | Client request HTTP method | GET |
http.request.uri | String | Client request URI path and query string | /articles/index?section=539061&expand=comments |
http.request.uri.path | String | Client request URI path | /articles/index |
http.request.file_extension | String | File extension of the client request file | jpg |
http.request.filename | String | Filename of the client request file | bot.txt |
http.request.uri.query | String | The whole query string of the client request, not including the ? separator | section=539061&expand=comments |
http.request.headers["key"] | String | The header value of the specified header name "key" in the client request, "key" can be replaced with your specified name | https://developer.mozilla.org |
http.request.uri.args["key"] | String | The parameter value of the specified parameter name "key" in the client query string, "key" can be replaced with your specified name | value |
http.request.version | String | The version of the HTTP protocol used in the client request | HTTP/1.0 HTTP/1.1 HTTP/2 HTTP/3 |
http.request.ip | String | Client TCP IP address, for example: 1.1.1.1 | 93.184.216.34 |
http.request.ip.port | String | Client Port | 1028 |
http.request.ip.city | String | City associated with the client IP address | San Francisco |
http.request.ip.continent | String | Continent code associated with the client IP address | AF: Africa AS: Asia EU: Europe NA: North America SA: South America OC: Oceania AN: Antarctica |
http.request.ip.country | String | 2-letter country code in ISO 3166-1 Alpha 2 format associated with the client IP address |
Use Case
1. The custom origin-pull request header carries the information of the country where the client IP address is located back to the origin.
![](https://cloudcache.intl.tencent-cloud.com/cms/backend-cms/d2f6aa0a470511eeb917525400b31cf9.jpeg)
2. Custom origin-pull request headers allow the origin server to collect and analyze which domains have been accelerated by Tencent's EdgeOne.
![](https://cloudcache.intl.tencent-cloud.com/cms/backend-cms/d2ed0e69470511eeb917525400b31cf9.jpeg)
3. Custom Cross-Origin Request Policy: Allows cross-origin requests from domains specified in the Origin header of the request.
![](https://cloudcache.intl.tencent-cloud.com/cms/backend-cms/d2fb2436470511eeb917525400b31cf9.jpeg)