Home > database >  S3 Bucket CORS configuration not accepted
S3 Bucket CORS configuration not accepted

Time:11-18

People of the internet, I need your help. I'm trying to put this code in my S3 butcket CORS and I get this error: Expected params.CORSConfiguration.CORSRules to be an Array

[
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "GET",
            "PUT",
            "POST",
        ],
        "AllowedOrigins": [
            "*"
        ],
        "ExposeHeaders": [],
        "MaxAgeSeconds": 3000
    }
]

Look here

CodePudding user response:

Your JSON is not valid. If you test this with an online (or other) validator, you'll see an error in your AllowedMethods, specifically that the final value in that array has a trailing comma (valid JavaScript, but invalid JSON).

Change the policy to this:

[{
    "AllowedHeaders": [
        "*"
    ],
    "AllowedMethods": [
        "GET",
        "PUT",
        "POST"
    ],
    "AllowedOrigins": [
        "*"
    ],
    "ExposeHeaders": [],
    "MaxAgeSeconds": 3000
}]
  • Related