Amazon S3: Font from origin has been blocked from loading by Cross-Origin Resource Sharing policy

Posted: September 25, 2015 in Web Server

Chrome gave me the above error when I moved our self-hosted bootstrap.js to S3.

To fix this is very easy, just login to S3 console and click the bucket and under permission, click Add CORS Configuration.

S3 will provide a sample configuration in the popup dialog, just update the AllowedOrigin element to set your domain. You can have multiple AllowedOrigin elements. For example, the result could be

    <CORSConfiguration>
        <CORSRule>
            <AllowedOrigin>http://www.yourdomain.com</AllowedOrigin>
            <AllowedOrigin>https://www.anotherdomain.com</AllowedOrigin>
            <AllowedMethod>GET</AllowedMethod>
            <MaxAgeSeconds>3000</MaxAgeSeconds>
            <AllowedHeader>Authorization</AllowedHeader>
        </CORSRule>
    </CORSConfiguration>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s