CORS Headers
Configure Cross-Origin Resource Sharing (CORS) headers to control which browser origins can send requests to a Stook Bucket.
CORS is a browser security mechanism. When JavaScript on a web page requests a resource from a different origin, the browser allows the request only when the target origin permits it.
CORS affects JavaScript requests made by web browsers. It does not affect:
Files loaded through HTML elements such as
<img>or<video>S3-compatible SDKs used outside a browser
AWS CLI requests
Server-side applications
How CORS Headers Work
When CORS Headers is enabled, the Stook Bucket accepts cross-origin browser requests from the origins configured under Allowed origins.
New Stook Buckets have CORS headers enabled by default with * as the allowed origin.
The following HTTP methods are supported for allowed origins:
DELETEGETHEADPOSTPUT
Requests can include any request headers. JavaScript can access the following response headers:
Content-LengthContent-TypeETagx-amz-request-id
When CORS headers are disabled, browsers block cross-origin requests to the Stook Bucket.
Allowed Origins
Add each origin that should be allowed to send browser requests to the Stook Bucket.
Supported formats include:
An exact origin, such as
https://example.comAll subdomains of a domain, such as
*.example.com*to allow requests from any origin
For exact origins, include the scheme, such as https://. The configured origin must match the origin sent by the browser.
Use lowercase domain names. localhost and IP addresses are not accepted as origins.
You can configure up to 100 origins.
Configure CORS Headers
Open the Stook Bucket
In the Medianova Control Panel, select Stook Object Storage → Buckets, then select the Stook Bucket you want to configure.
Configuration Fields
Enabled
Enables or disables CORS headers for the Stook Bucket.
On
Allowed origins
Specifies the browser origins that can send cross-origin requests to the Stook Bucket. Supports up to 100 origins.
*
Configure CORS Headers with the API
Use the bucket settings endpoint to configure CORS headers:
Send:
The request enables CORS headers and allows browser requests from the specified origins.
To disable CORS headers, send:
Troubleshooting
More than 100 origins are configured
A Stook Bucket supports up to 100 CORS origins.
Remove unnecessary origins or use a subdomain wildcard such as *.example.com to cover multiple origins.
An origin is not accepted
Confirm that the origin uses a supported format, such as:
or:
Use lowercase domain names. localhost and IP addresses are not supported.
The browser reports a CORS error
Confirm that:
CORS Headers is enabled.
The web page's origin is included in Allowed origins.
The configured origin matches the origin sent by the browser, including the scheme and port.
If you recently changed the configuration, clear the browser cache or wait for the cached CORS response to expire.
Related Topics
Last updated
Was this helpful?
