Skip to content

Instantly share code, notes, and snippets.

@tmilewski
Created May 10, 2013 05:29
Show Gist options
  • Star 59 You must be signed in to star a gist
  • Fork 26 You must be signed in to fork a gist
  • Save tmilewski/bfaebc876cc116623e86 to your computer and use it in GitHub Desktop.
Save tmilewski/bfaebc876cc116623e86 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>http://www.your-site.com</AllowedOrigin>
<AllowedOrigin>https://www.your-site.com</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>HEAD</AllowedMethod>
<AllowedMethod>DELETE</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
</CORSRule>
</CORSConfiguration>
@lacostenycoder
Copy link

Nice thanks!

@maur1th
Copy link

maur1th commented May 27, 2017

Great, thanks!

Copy link

ghost commented Aug 27, 2017

It works! Thanks!

@collarbone
Copy link

Nice!

@clint74
Copy link

clint74 commented Dec 1, 2017

Great, thanks! Saved me hours.

@mj12albert
Copy link

Can I have multiple <AllowedOrigin>s as long as they are all either https or http?

@greg-benner-klick-sensei
Copy link

greg-benner-klick-sensei commented Sep 6, 2018

Can also <AllowedOrigin>*</AllowedOrigin> if you want any site to be able to access the asset

@chetan-kukadiya
Copy link

Great, it's work for me. thanks

@samirtendulkar
Copy link

Thanks Dude you're the best

@Ralpharama
Copy link

Thanks :) Very useful

@guglielmo
Copy link

guglielmo commented Apr 1, 2021

In the new AWS S3 console, the configuration must be passed in JSON format,
that would be:

[
    {
        "AllowedOrigins": [
            "https://www.your-site.com<",
            "http://www.your-site.com<",
            "http://checknews.openpolis.it",
            "https://checknews.openpolis.it"
        ],
        "AllowedMethods": [
            "POST",
            "GET",
            "PUT"
        ]
    }
]

@hsb-tonmoy
Copy link

In the new AWS S3 console, the configuration must be passed in JSON format,
that would be:

[
    {
        "AllowedOrigins": [
            "https://www.your-site.com<",
            "http://www.your-site.com<",
            "http://checknews.openpolis.it",
            "https://checknews.openpolis.it"
        ],
        "AllowedMethods": [
            "POST",
            "GET",
            "PUT"
        ]
    }
]

Thanks man!

@dtheekshanalinux
Copy link

@guglielmo it's still not working.Do you have another suggestion

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