Home > OS >  Data Type Mismatch and Policies must be valid JSON and the first byte must be '{'
Data Type Mismatch and Policies must be valid JSON and the first byte must be '{'

Time:09-21

I need to make a CORS Policy for my S3 Bucket.

In the console, it says the policy has to be valid JSON. I copy and paste their examples and immediately it errors stating they're formatted improperly. This is basically what I'm trying:

[
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "POST"
        ],
        "AllowedOrigins": [
            "https://localhost:3000",
            "https://mywebsite.com",
        ]
    }
]

Apparently something is wrong:

enter image description here

CodePudding user response:

The CORS policy is a standalone policy that needs to be specified in the origin resource sharing (CORS) for the bucket. You need to enter the policy that you have there.

  • Related