dcloud s3 bucket-cors set

Replace the bucket’s CORS rules

IAM s3:PutBucketCORSChanges stateAsks before it deletes (-y skips)

The same rules `aws s3api put-bucket-cors` writes over the S3 API, for every bucket. The gateway answers browser preflights (OPTIONS) from them and adds Access-Control-* headers to matching responses, presigned URLs included. Example: --rules '{"allowedOrigins":["https://app.example.com"],"allowedMethods":["GET","PUT"],"allowedHeaders":["*"],"exposeHeaders":["ETag"],"maxAgeSeconds":3000}'

Synopsis

dcloud s3 bucket-cors set name --rules rules

Arguments

  • <name>Required

    string

    Also accepted as --name. Constraints: 3-63 chars, /^[a-z0-9][a-z0-9-]*[a-z0-9]$/

Flags

  • --rulesRequired

    array of json

    The rules, replacing the current ones: { allowedOrigins, allowedMethods, allowedHeaders?, exposeHeaders?, maxAgeSeconds?, id? }; the first rule that matches a request applies

Example

dcloud s3 bucket-cors set name --rules '["example"]'

Generated from the API description, the same one the API checks requests against and the CLI is built from.