PUT /accounts/{account_id}/r2/buckets/{bucket_name}/cors
Set the CORS policy for a bucket.
Servers
- https://api.cloudflare.com/client/v4
Path parameters
Name | Type | Required | Description |
---|---|---|---|
bucket_name |
String | Yes | |
account_id |
String | Yes |
Request headers
Name | Type | Required | Description |
---|---|---|---|
Content-Type |
String | Yes |
The media type of the request body.
Default value: "application/json" |
cf-r2-jurisdiction |
String | No |
Possible values:
Default value: "default" |
Request body fields
Name | Type | Required | Description |
---|---|---|---|
rules[] |
Array | No | |
rules[].id |
String | No |
Identifier for this rule. |
rules[].maxAgeSeconds |
Number | No |
Specifies the amount of time (in seconds) browsers are allowed to cache CORS preflight responses. Browsers may limit this to 2 hours or less, even if the maximum value (86400) is specified. |
rules[].allowed |
Object | Yes |
Object specifying allowed origins, methods and headers for this CORS rule. |
rules[].allowed.methods[] |
Array | Yes |
Specifies the value for the Access-Control-Allow-Methods header R2 sets when requesting objects in a bucket from a browser. |
rules[].allowed.origins[] |
Array | Yes |
Specifies the value for the Access-Control-Allow-Origin header R2 sets when requesting objects in a bucket from a browser. |
rules[].allowed.headers[] |
Array | No |
Specifies the value for the Access-Control-Allow-Headers header R2 sets when requesting objects in this bucket from a browser. Cross-origin requests that include custom headers (e.g. x-user-id) should specify these headers as AllowedHeaders. |
rules[].exposeHeaders[] |
Array | No |
Specifies the headers that can be exposed back, and accessed by, the JavaScript making the cross-origin request. If you need to access headers beyond the safelisted response headers, such as Content-Encoding or cf-cache-status, you must specify it here. |
How to start integrating
- Add HTTP Task to your workflow definition.
- Search for the API you want to integrate with and click on the name.
- This loads the API reference documentation and prepares the Http request settings.
- Click Test request to test run your request to the API and see the API's response.