Customizes a header for requests before they are redirected to the origin server for an accelerated domain name.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes SetReqHeaderConfig

The operation that you want to perform. Set the value to SetReqHeaderConfig.

DomainName String Yes www.macaron.org.cn

The accelerated domain names. You can specify multiple domain names and separate them with commas (,).

Key String Yes testkey

The key of the custom header.

Value String Yes testvalue

The value of the custom header.

ConfigId Long No 123

The ID of the configuration.

Response parameters

Parameter Type Example Description
RequestId String 04F0F334-1335-436C-A1D7-6C044FE73368

The ID of the request.

Examples

Sample requests

http(s)://cdn.aliyuncs.com?Action=SetReqHeaderConfig
&DomainName=www.macaron.org.cn
&Key=testkey
&Value=testvalue
&<Common request parameters>

Sample success responses

XML format

<SetReqHeaderConfigResponse>
      <RequestId>04F0F334-1335-436C-A1D7-6C044FE73368</RequestId>
</SetReqHeaderConfigResponse>

JSON format

{
    "RequestId": "04F0F334-1335-436C-A1D7-6C044FE73368"
}

Error codes

HttpCode Error code Error message Description
400 MissingParameter The specified value of parameter DomainName can not be empty. The error message returned because the DomainName parameter is not set.
400 MissingParameter The specified value of parameter Key can not be empty. The error message returned because the Key parameter is not set.
400 MissingParameter The specified value of parameter Value can not be empty. The error message returned because the Value parameter is not set.
400 InvalidKey.Malformed The specified value of parameter Key is not malformed. The error message returned because the format of the specified value for the Key parameter is invalid.
400 InvalidValue.Malformed The specified value of parameter Value is not malformed. The error message returned because the Value parameter is set to an invalid value.
400 InvalidHeaderKey.ValueNotSupported The specified value of parameter HeaderKey is not supported. The error message returned because the HTTP header is set to an invalid value. Valid values: Content-Type, Cache-Control, Content-Disposition, Content-Language, Expires, Access-Control-Allow-Origin, Access-Control-Allow-Methods, Access-Control-Allow-Headers, Access-Control-Max-Age, Access-Control-Expose-Headers, and Access-Control-Allow-Credentials.

For a list of error codes, visit the API Error Center.