QueryHttpHeaderConfig

Update time: 2026-08-25 10:26:28

Applicable Products

Content Acceleration,Dynamic Web Acceleration,Media Acceleration VoD,Media Acceleration Live Broadcast

API Description

Query http header configuration via interface self - service. The interface * can be domain name or domain id.

Call frequency

Single user trigger frequency: 300/5min

Request parameter(s)

Path Params

NameDescription
*domain-nameString
the domain whoes need query config

Response parameter(s)

Body Params

NameDescription
domain-nameString
Domain name or domain name id to query configuration
domain-idString
Domain name or domain name id to query configuration
header-modify-rulesList
except-path-patternString
Exception url matching pattern, support regular. Example:
custom-patternString
Matching conditions: specify common types, optional values are all or homepage. 1. all: all files 2. homepage: home page
file-typeString
Matching conditions: file type, please separate by semicolon, optional values: gif png bmp jpeg jpg html htm shtml mp3 wma flv mp4 wmv zip exe rar css txt ico js swf m3u8 xml f4m bootstarp ts.
custom-file-typeString
Matching condition: Custom file type, separate by semicolon.
directoryString
directory
specify-urlString
Matching Condition: Specify URL. The input parameter does not support the URI format starting with http(s)://
request-methodString
The matching request method, the optional values are: GET, POST, PUT, HEAD, DELETE, OPTIONS, separate by semicolons.
data-idObject
Add a grid type identifier to indicate a specific group configuration when the client has multiple groups of configurations.
path-patternString
The url matching mode supports fuzzy regularization. If all matches, the input parameters can be configured as:
header-directionString
The control direction of the http header, the optional value is cache2visitor/cache2origin/visitor2cache/origin2cache, single-select. Cache2origin refers to the source direction---corresponding to the configuration item return source request; Cache2visitor refers to the direction of the client back - the corresponding configuration item returns to the client response; Visitor2cache refers to receiving client requests Origin2cache refers to the receiving source response
actionString
The control type of the http header supports the addition and deletion of the http header value. The optional value is add|set|delete, which is single-selected. Corresponding to the header-name and header-value parameters Add: add a header Set: modify the header Delete: delete the header Note: priority is delete>set>add
allow-regexpString
Http header regular match, optional value: true / false. True: indicates that the value of the header-name is handled as a regular match. False: indicates that the value of the header-name is processed according to the actual parameters, and no regular match is made. Do not pass the default is false
header-nameString
Http header name, add or modify the http header, only one is allowed; delete the http header to allow multiple entries, separated by a semicolon ';'. Note: The operation of the special http header is limited, and the http header and operation type of the operation are allowed. This item is required and cannot be empty When the action is add: indicates that the header-name header is added. When the action is set: modify the header-name header When the action is delete: delete the header-name header
header-valueString
The value corresponding to the HTTP header field, for example: mytest.example.com Note: 1. When the action is add or set, the input parameter must be passed a value 2. When the action is delete, the input parameter is not passed Support to get the value of specified variable by keyword, such as client IP, including: Key words: meaning #timestamp: current time, timestamp as 1559124945 #request-host: host in the request header #request-url: request url, which contains the full path of the protocol domain name, etc., such as http://aaa.aa.com/a.html #request-uri: request uri, relative path format, such as /index.html #origin- IP: return source IP #cache-ip: edge node IP #server-ip: external service IP #client-ip: client IP, or visitor IP #response-header{XXX} : get the value in the response header, such as #response-header{etag}, get the etag value in response-header #header{XXX} : to get the value in the HTTP header of the request, such as #header{user-agent}, is to get the user-agent value in the header #cookie{XXX} : get the value in the cookie, such as #cookie{account}, is to get the value of the account set in the cookie
header-value-oldString
The original value corresponding to the HTTP header field
request-headerString
Match request header, header values support regular, header and header values separated by Spaces, e.g. : Range bytes=[0-9]{9,}
priorityString
Indicates the priority of execution order for multiple sets of configurations. A higher number indicates higher priority. If no parameters are passed, the default value is 10 and cannot be cleared.
except-file-typeString
Exception file type.
except-directoryString
Exception directory.
except-request-methodString
Exception request method.
except-request-headerString
Exception request header.
overrideString
HTTP Header Override Option, Values: true/false/.Empty string true: If the specified header already exists, the original header will be overwritten. If the header does not exist, a new header will be added. false: If the specified header already exists, the original header remains unchanged. If the header does not exist, a new header will be added. Empty string: indicating to clear the configuration Note: This override operation only applies to the cache2origin and cache2visitor directions.
uaString
User-Agent, multiple values separated by vertical bar (|)
except-uaString
Exceptional User-Agent, multiple values separated by vertical bar (|)
status-codeString
HTTP Status Code, multiple values separated by semicolons (;)
except-status-codeString
Exceptional HTTP Status Code, multiple values separated by semicolons (;)
except-custom-file-typeString
Exception Custom File Type, multiple values separated by semicolons (;)
response-headerString
Response Headers, e.g.: cache-control max-age=, multiple values not allowed
except-response-headerString
Exceptional Response Headers, e.g.: cache-control max-age=, multiple values not allowed

Error code

Error code(code)Description(message)HTTP statusSemantic
InvalidParameterNo domain name was specified.400No domain name was specified.
NoSuchDomainThe specified domain does not exist.404The specified domain does not exist.
CustomerNoOwnDomaincustomer not own domain name[{your customer code}]400customer not own domain name[{your customer code}]

Example

JSON
XML
JSON
Request example
Copy Copy success
#!/bin/bash
username="example_username"
apiKey="example_apiKey"
date=`env LANG="en_US.UTF-8" date -u "+%a, %d %b %Y %H:%M:%S GMT"`
password=`echo -en "$date" | openssl dgst -sha1 -hmac $apiKey -binary | openssl enc -base64`
curl -i --url "https://{@apiDomain}/api/config/headermodify/www.example.com" \
-X "GET" \
-u "$username:$password" \
-H "Date: $date" \
-H "Accept: application/json" \
-H "Content-Type:application/json"
Response example
Copy Copy success
HTTP/1.1 200 OK
Date: Sun, 05 May 2019 09:08:53 GMT
Content-Type: application/json;charset=utf-8
x-cnc-request-id: 83bbebc7-2c95-47d7
{
    "domain-id":"123344",
    "domain-name":"www.example.com",
    "header-modify-rules":[
                    {
                    "path-pattern": ".*",
                    "request-header": "My-Http-Header .",
                    "header-direction": "cache2visitor",
                    "action": "add",
                    "header-name": "My-Http-Header",
                    "header-value": "#header{My-Http-Header}",
                    "override":"true"
          },
                    {
                    "path-pattern": "/def",
                    "header-direction": "cache2visitor",
                    "action": "set",
                    "header-name": "Server",
                    "header-value": "my_new_value"
          },
                    {
                    "path-pattern": "/abc",
                    "header-direction": "cache2visitor",
                    "action": "delete",
                    "header-name": "Via"
          }
]
}