Skip to content

CORS

You can set CORS rules on your bucket, which is useful if you want to access the assets in your bucket from javascript.

Below is an example CORS configuration that allows all origins to access your bucket.

xml
<CORSConfiguration>
    <CORSRule>
        <ID>Allow all cors</ID>
        <AllowedOrigin>*</AllowedOrigin>
        <AllowedMethod>GET</AllowedMethod>
        <AllowedMethod>HEAD</AllowedMethod>
        <AllowedHeader>*</AllowedHeader>
        <MaxAgeSeconds>86400</MaxAgeSeconds>
    </CORSRule>
</CORSConfiguration>

You can apply this configuration as follows: s3cmd setcors rules.xml s3://bucketname

You can view the current CORS configuration of your bucket by running: s3cmd info s3://bucketname

And you can delete the CORS configuration with: s3cmd delcors s3://bucketname