mc cors set
Sets the Cross-Origin Resource Sharing (CORS) configuration for a bucket.
Syntax
- CLI
-
USAGE: mc cors set ALIAS/BUCKET CORSFILE mc cors set-json ALIAS/BUCKET CORSFILE FLAGS: --json enable JSON lines formatted output --debug enable debug output --insecure disable SSL certificate verification --help, -h show help
Parameters
Parameter | Description |
---|---|
CORSFILE |
The path to the XML file containing the CORS configuration. |
json |
Enable JSON formatted output. |
debug |
Enable output for debugging. |
insecure |
Disable SSL verification. |
help |
Show this help. |
Examples
-
Set the CORS configuration for the bucket named
mybucket
with aliasmyminio
, where the CORS configuration input is in the xml format file/path/to/cors.xml
:- CLI
-
mc cors set myminio/mybucket /path/to/cors.xml
<CORSConfiguration> <CORSRule> <AllowedOrigin>https://localhost:8000</AllowedOrigin> <AllowedHeader>Authorization</AllowedHeader> <AllowedHeader>User-Agent</AllowedHeader> <AllowedHeader>SHA256</AllowedHeader> <AllowedHeader>X-Mapr-Account</AllowedHeader> <AllowedHeader>X-Amz-Date</AllowedHeader> <AllowedMethod>GET</AllowedMethod> <MaxAgeSeconds>3000</MaxAgeSeconds> <ExposeHeader>X-Amz-Server-Side-Encryption</ExposeHeader> <ExposeHeader>x-amz-request-id</ExposeHeader> </CORSRule> </CORSConfiguration>
-
Set the CORS configuration for the bucket named
mybucket
with aliasmyminio
, where the CORS configuration input is in the json format file/path/to/cors.json
:- CLI
-
mc cors set-json myminio/mybucket /path/to/cors.json
{ "CORSRules": [ { "AllowedOrigins": ["*"], "AllowedHeaders": ["Authorization"], "MaxAgeSeconds": 3000, "AllowedMethods": ["PUT", "GET"], "ExposeHeaders": ["Access-Control-Allow-Origin"] }, { "AllowedOrigins": ["*", "https://8689432rmsan@example.com"], "AllowedHeaders": ["Content-Type", "x-amz"], "AllowedMethods": ["PUT"], "MaxAgeSeconds": 3000 } ] }