Skip to content

Instantly share code, notes, and snippets.

@jsoma
Created September 4, 2020 21:08
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jsoma/ed9eb3d0d42ea7db0f0b748a12d30951 to your computer and use it in GitHub Desktop.
Save jsoma/ed9eb3d0d42ea7db0f0b748a12d30951 to your computer and use it in GitHub Desktop.
CORS public access
<CORSConfiguration>
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
</CORSRule>
</CORSConfiguration>
@Manthanc007
Copy link

It's showing this error - The CORS configuration must be written in valid JSON.

@qyvlik
Copy link

qyvlik commented Dec 25, 2020

@Manthanc007

new format as follow, see https://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html

[
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "PUT",
            "POST",
            "DELETE"
        ],
        "AllowedOrigins": [
            "http://www.example1.com"
        ],
        "ExposeHeaders": []
    },
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "PUT",
            "POST",
            "DELETE"
        ],
        "AllowedOrigins": [
            "http://www.example2.com"
        ],
        "ExposeHeaders": []
    },
    {
        "AllowedHeaders": [],
        "AllowedMethods": [
            "GET"
        ],
        "AllowedOrigins": [
            "*"
        ],
        "ExposeHeaders": []
    }
]

@codeyourwayup
Copy link

To allow GET from anywhere
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment