Create CORS Headers
Create CORS Headers for website acceleration.This operation is a full replacement: all existing CORS headers configured for the service will be removed and replaced by the provided values.
Request
Request-Line
POST /waap/v1.0/services/{serviceId}/corsHeaders HTTP/1.1
Request Parameters
Path Parameters
Parameter | Type | Required | Description |
---|---|---|---|
serviceId | Integer | Mandatory | Service ID. |
Body Parameters
Parameter | Type | Required | Description |
---|---|---|---|
accessControlAllowOrigin | String | Optional | Response 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'. |
accessControlExposeHeaders | String | Optional | Headers can be exposed as part of the response by listing their names. This header accepts any string value. E.g. "Content-Length". |
accessControlMaxAge | Integer | Optional | How long in seconds the results of a preflight request can be cached. The provided value must be either non-negative int or -1. |
accessControlAllowCredentials | Boolean | Optional | Whether to expose the response to frontend JavaScript code. Must be true. |
accessControlAllowMethods | String | Optional | Methods 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". |
accessControlAllowHeaders | String | Optional | HTTP 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 Code | Error Code | Error Message |
---|---|---|
400 | Request.BadRequest | Bad request. |
400 | ServiceId.Invalid | ServiceId is empty or invalid. |
400 | AccessControlAllowOrigin.Invalid | AccessControlAllowOrigin is empty or invalid. |
400 | AccessControlMaxAge.Invalid | AccessControlMaxAge is empty or invalid. |
400 | AccessControlAllowMethods.Invalid | AccessControlAllowMethods is empty or invalid. |
400 | AccessControlAllowCredentials.Invalid | AccessControlAllowCredentials is empty or invalid. |
400 | CorsHeaders.OperationFailed | The Cors Headers operation failed. |
404 | ServiceId.NotFound | ServiceId is not found. |
Examples
Create CORS Headers
Request
POST /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"
}