Skip to main content

Update CORS Headers

Update CORS Headers for website acceleration.

Request

Request-Line

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

Request Parameters

Path Parameters

ParameterTypeRequiredDescription
serviceIdIntegerMandatoryService ID.

Body Parameters

ParameterTypeRequiredDescription
accessControlAllowOriginStringOptionalResponse 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'.
accessControlExposeHeadersStringOptionalHeaders can be exposed as part of the response by listing their names. This header accepts any string value. E.g. "Content-Length".
accessControlMaxAgeIntegerOptionalHow long in seconds the results of a preflight request can be cached. The provided value must be either non-negative int or -1.
accessControlAllowCredentialsBooleanOptionalWhether to expose the response to frontend JavaScript code. Must be true.
accessControlAllowMethodsStringOptionalMethods allowed when accessing the resource in response to a preflight request. It should be either single http method or comma-separated list of http methods: GET, POST, PUT, DELETE, HEAD, OPTIONS, CONNECT and TRACE. E.g. "GET, POST".
accessControlAllowHeadersStringOptionalHTTP headers can be used during the actual request. This header accepts any string value. E.g. "X-Customer-Token".

Response

Status Codes, Error Codes and Error Messages

Status CodeError CodeError Message
400Request.BadRequestBad request.
400ServiceId.InvalidServiceId is empty or invalid.
400AccessControlAllowOrigin.InvalidAccessControlAllowOrigin is empty or invalid.
400AccessControlMaxAge.InvalidAccessControlMaxAge is empty or invalid.
400AccessControlAllowMethods.InvalidAccessControlAllowMethods is empty or invalid.
400AccessControlAllowCredentials.InvalidAccessControlAllowCredentials is empty or invalid.
400CorsHeaders.OperationFailedThe Cors Headers operation failed.
404ServiceId.NotFoundServiceId is not found.

Examples

Update CORS Headers

Request

PUT /waap/v1.0/services/12345/corsHeaders HTTP/1.1

{
"accessControlAllowOrigin": "https://www.example.com",
"accessControlExposeHeaders": "Content-Length, X-Request-Id",
"accessControlMaxAge": 3600,
"accessControlAllowCredentials": true,
"accessControlAllowMethods": "GET,POST,OPTIONS",
"accessControlAllowHeaders": "Content-Type, Authorization"
}