3

I am using S3 CORS for serving fonts. If S3 domain name is used for serving fonts, it works in Firefox, but when CloudFront is used, it doesn't. Works with Google Chrome.

My CORS configuration on S3

<?xml version="1.0" encoding="UTF-8"?>
 <CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
 <CORSRule>
     <AllowedOrigin>http://*.example.com</AllowedOrigin>
     <AllowedMethod>GET</AllowedMethod>
     <MaxAgeSeconds>30000</MaxAgeSeconds>
     <AllowedHeader>Content-*</AllowedHeader>
     <AllowedHeader>Host</AllowedHeader>
 </CORSRule>
 <CORSRule>
     <AllowedOrigin>https://*.example.com</AllowedOrigin>
     <AllowedMethod>GET</AllowedMethod>
     <MaxAgeSeconds>30000</MaxAgeSeconds>
     <AllowedHeader>Content-*</AllowedHeader>
     <AllowedHeader>Host</AllowedHeader>
 </CORSRule>
</CORSConfiguration>
  • FYI, it works with Google Chrome because Google Chrome doesn't care about CORS for webfonts. – ceejayoz Oct 26 '12 at 16:35
5

In order for me to get this working. I had to set the CORS configuration to include the CloudFront distribution domain.

I also had to change the settings in my CloudFront distribution behaviors, to Allow forwarding of query strings. I cant recall where I saw that was a requirement.

I then invalidated the fonts causing the issues.

Then we were good to go!

hope that helps

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <CORSRule>
        <AllowedOrigin>https://*.domain.com</AllowedOrigin>
        <AllowedOrigin>http://*.domain.com</AllowedOrigin>
        <AllowedOrigin>http://d2e7ljkkwgm4dt.cloudfront.net</AllowedOrigin>
        <AllowedOrigin>http://dpibywtcfxy6z.cloudfront.net</AllowedOrigin>
        <AllowedMethod>GET</AllowedMethod>
        <MaxAgeSeconds>3000</MaxAgeSeconds>
        <AllowedHeader>Content-*</AllowedHeader>
        <AllowedHeader>Host</AllowedHeader>
    </CORSRule>
</CORSConfiguration>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.