Cross Domain Fonts with Nginx?
Having seen a few issues with cross domain web fonts with Firefox and a report of the same in Chrome. This small addition to an Nginx server config allows access from any origin, in this case for a fonts in a Rails asset pipeline. This config solves the problem of another site pinching our fonts. However, more importantly this allows cloudfront to sit in front of our origin server and for our site to serve fonts over cloudfront.
location ~ "^/assets/(.*/)*.*-[0-9a-f]{32}\.(woff|ttf|eot)$" {
gzip_static on;
expires 1h;
add_header Cache-Control public;
add_header Access-Control-Allow-Origin *;
# debug to check this is being caught.
add_header X-Braindeaf-Pipeline true;
}
With the right syntax, we should probably limit the origin to *.cloudfront.net domains, and to our specific distrubitions in a more complete solution.