Skip to main content

Update CORS Headers

Updates CORS Headers for website acceleration.

Request

Request-Line

PUT /cdn/v1.0/services/{serviceId}/corsHeaders HTTP/1.1

Request Parameters

Path Parameters

ParameterTypeRequiredDescription
serviceIdIntegerMandatoryService ID.

Body Parameters

ParameterTypeRequiredDescription
accessControlAllowOriginStringOptionalSpecifies which origins can access the response. Must be either *(allow all) or in the format schema://fqdn (e.g., https://www.example.com). null is not allowed.
accessControlExposeHeadersStringOptionalLists the headers that can be exposed to the browser when the requesting code runs in a CORS context. Accepts a comma-separated list of header names (e.g., "Content-Length, X-Request-Id").
accessControlMaxAgeIntegerOptionalMaximum time (in seconds) that a CORS preflight response can be cached. Accepts non-negative integers. 0 means no cache. Default is -1 (cache indefinitely).
accessControlAllowCredentialsBooleanOptionalThe server allows credentials to be included in cross-origin HTTP requests. true is the only valid value for this header and is case-sensitive. If you don't need credentials, omit this header entirely rather than setting its value to false.
accessControlAllowMethodsStringOptionalHTTP methods allowed for cross-origin requests. Accepts a single method or a comma-separated list. Supported values: GET, POST, PUT, DELETE, HEAD, OPTIONS, CONNECT, TRACE, PATCH.
accessControlAllowHeadersStringOptionalHTTP headers that can be used during the actual request. Accepts a comma-separated list of header names (e.g., "Content-type, Authorization").

Response

Status Codes, Error Codes and Error Messages

Status CodeError CodeError Message
400Request.BadRequestBad request.
400InvalidCustomer.IdEmptyCustomer ID cannot be empty or invalid.
400InvalidService.IdIncorrectService ID is empty or invalid.
400InvalidService.IdPermissionService ID cannot be found or unknown.
400InvalidOrigin.UrlFormatThe origin must be in scheme://fqdn format.
400InvalidPolicy.CorsHeaderForMethodInvalid method. HTTP method must be one of the following values: GET, POST, PUT, DELETE, HEAD, OPTIONS, CONNECT, TRACE, or PATCH.
400InvalidPolicy.CorsHeaderForCredentialsCORS Credential must be set to true.
400InvalidPolicy.CorsHeaderForHeaderCORS Allow Header cannot be empty.
400InvalidPolicy.CorsHeaderForMaxAgeCORS Max Age must be a non-negative integer.
400InvalidPolicy.CorsHeaderForExposeHeaderCORS Expose Header cannot be empty.

Examples

Update CORS Headers

Request

PUT /cdn/v1.0/services/228654/corsHeaders HTTP/1.1

{
"accessControlMaxAge": 60
}

Successful Response Body

HTTP/1.1 200