Creates a custom HTTP header.

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 SetHttpHeaderConfig

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

DomainName String Yes example.com

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

HeaderKey String Yes Content-Type

The parameter of the HTTP header. 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
  • Access-Control-Allow-Credentials
HeaderValue String Yes application

The value of the HTTP header.

ConfigId Long No 123

The ID of the configuration.

Response parameters

Parameter Type Example Description
RequestId String 16A96B9A-F203-4EC5-8E43-CB92E68F4CD8

The ID of the request.

Examples

Sample requests

http(s)://cdn.aliyuncs.com?Action=SetHttpHeaderConfig
&DomainName=example.com
&HeaderKey=Content-Type
&HeaderValue=application
&<Common request parameters>

Sample success responses

XML format

<SetHttpHeaderConfigResponse>
      <RequestId>AED00EC1-32A8-4D48-BEB9-BD782AF3C6BD</RequestId>
</SetHttpHeaderConfigResponse>

JSON format

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

Error codes

HttpCode Error code Error message Description
400 InvalidHeaderKey.ValueNotSupported The specified value of parameter HeaderKey is not supported. The error message returned because the specified HTTP header is invalid. 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.