0

We use some cloud.typography.com webfonts (smart fonts) on our website, instead of hosting them on our server we want to use cloudfront.

Our cloudfront distribution https://static.mywebsite.com points to an Amazon s3 bucket, https://mywebsite.s3.amazonaws.com/

I generated the fonts at the location https://static.mywebsite.com/fonts on the cloud.typography website and then downloaded and uploaded them to the bucket. I then confirmed that I can access individual files e.g. https://static.mywebsite.com/fonts/501111/fontfile.woff and that was fine.

Next I checked my CORS definition for the bucket:

<CORSConfiguration> 
<CORSRule>          
<AllowedOrigin>*</AllowedOrigin>         
<AllowedMethod>GET</AllowedMethod>         
<MaxAgeSeconds>3000</MaxAgeSeconds>         
<AllowedHeader>Authorization</AllowedHeader>    
</CORSRule>
</CORSConfiguration>

And then in Cloudfront I altered my 'behaviours' to whitelist the Origin header and saved that.

When I try and confirm the installation at cloud.typography I get this:

Server Error at static.mywebsite.com Your webserver responded with “Error 500 (Internal Server Error).” Try reconfirming the installation, and if the problem persists, contact whomever at your organization administers your web server.

Any ideas why and what I need to do to get this working? I'm wondering if I have made an error, if this simply isn't possible, or if their cloud.typography website can't handle this config?

I've logged a call with them but they're not responding yet.

sideshowbarker
  • 81,827
  • 26
  • 193
  • 197
Ralpharama
  • 441
  • 4
  • 20

1 Answers1

0

Turns out the answer is wait an hour :/

Without any configuration changes I tried again an hour later and it published/validated fine.

Ralpharama
  • 441
  • 4
  • 20
  • 1
    You might have found an [invalidation](http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html) handy. This can be used to purge anything or everything from your CloudFront distribution's cached content, so that subsequent requests are fetched fresh. You may also want to reduce the [error caching minimum TTL](https://stackoverflow.com/a/35541525/1695906). – Michael - sqlbot Jun 27 '17 at 19:46
  • Thanks, I actually (despite the way I described it) checked the CORS and Whitelisted the Origin before I uploaded the fonts, so didn't even think that invalidation would be useful. Definitely probably worth trying though, also the error cache ttl - thanks for the suggestions. – Ralpharama Jun 28 '17 at 08:20