Nuno Silva
Nuno Silva

Reputation: 758

AWS S3 Static WebSite Hosting - Failed to decode downloaded font

I'm hosting a SPA written in AngularJS on an AWS S3 bucket. The only thing that is not working are fonts, with these warnings showing up in Chrome's developer console:

Failed to decode downloaded font: http://site.s3-website-ap-southeast-1.amazonaws.com/styles/ui-grid.woff
Failed to decode downloaded font: http://site.s3-website-ap-southeast-1.amazonaws.com/styles/ui-grid.ttf?

The fonts are downloaded and even inspect-able on the network panel. The same happens for Bootstrap3 fonts - I was not able to get a single font working.

This happens on Firefox:

downloadable font: incorrect file size in WOFF header (font-family: "ui-grid" style:normal weight:normal stretch:normal src index:1)
source: http://site.s3-website-ap-southeast-1.amazonaws.com/styles/ui-grid.woff
downloadable font: rejected by sanitizer (font-family: "ui-grid" style:normal weight:normal stretch:normal src index:1)
source: http://site.s3-website-ap-southeast-1.amazonaws.com/styles/ui-grid.woff vendor.03dd8a42.css
downloadable font: incorrect entrySelector for table directory (font-family: "ui-grid" style:normal weight:normal stretch:normal src index:2)
source: http://site.s3-website-ap-southeast-1.amazonaws.com/styles/ui-grid.ttf? vendor.03dd8a42.css
downloadable font: rejected by sanitizer (font-family: "ui-grid" style:normal weight:normal stretch:normal src index:2)
source: http://site.s3-website-ap-southeast-1.amazonaws.com/styles/ui-grid.ttf?

Upvotes: 3

Views: 1157

Answers (2)

Martin
Martin

Reputation: 1435

Had this kind of error, worked in development (Eclipse) but failed in production. Compared file sizes and noticed there was difference.

Problem was wrong content type setting for versioning system (cvs).

Solution was setting content type to binary for all font files solved the issue. Needed to restart eclipse after changing content type settings, and also delete and re-commit files.

Upvotes: 1

Nuno Silva
Nuno Silva

Reputation: 758

I am using Grunt to build the app, and it has a step that does "string-replace".

Turns out it was parsing the binary font files and changing some bytes around causing the file to be corrupt.

Upvotes: 0

Related Questions