Skip to main content

Get CORS Headers

Retrieves CORS Headers for website accleration domain.

Request

Request-Line

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

Request Parameters

Path Parameters

ParameterTypeRequiredDescription
serviceIdIntegerMandatoryService ID.

Response

Response Body

ParameterTypeDescription
accessControlAllowOriginStringResponse can be shared with requesting code from the given origin. Please note that null value is not allowed, it must be either '*' or 'scheme://fqdn'.
accessControlExposeHeadersStringHeaders can be exposed as part of the response by listing their names. This header accepts any string value. E.g. "Content-Length".
accessControlMaxAgeIntegerMaximum time in seconds that a CORS preflight response can be cached. Accepts non-negative integers or -1 (0 = no cache, -1 = cache indefinitely).
accessControlAllowCredentialsBooleanIndicates whether the response can be exposed to frontend JavaScript. Must be true.
accessControlAllowMethodsStringAccepts a single method or a comma-separated list from: GET, POST, PUT, DELETE, HEAD, OPTIONS, CONNECT, TRACE.
accessControlAllowHeadersStringHTTP headers can be used during the actual request. This header accepts any string value. E.g. "X-Customer-Token".

Status Codes, Error Codes and Error Messages

Status CodeError CodeError Message
400Request.BadRequestBad request.
400InvalidCustomer.IdEmptyCustomer id can be empty or invalid.
400InvalidService.IdIncorrectService id is empty or invalid.
400ServiceId.IdPermissionServiceId can not be found or unknown.

Examples

Get CORS Headers

Request

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

Successful Response Body

{
"Access-Control-Allow-Methods": "GET,POST,OPTIONS",
"Access-Control-Expose-Headers": "Content-Length, X-Request-Id",
"Access-Control-Allow-Credentials": "true",
"Access-Control-Allow-Headers": "Content-Type, Authorization",
"Access-Control-Allow-Origin": "https://www.example.com",
"Access-Control-Max-Age": 60
}