简体   繁体   中英

Serving Fonts on Cloudfront with Heroku

I'm trying to setup with Cloudfront on Heroku following the instructions here: https://devcenter.heroku.com/articles/using-amazon-cloudfront-cdn-with-rails

Cloudfront is serving css and js assets fine, but I can't get the font icons to be served. I have my icon font in assets/fonts and I'm loading the fonts in the stylesheet like this:

@font-face {
  src: font-url('dripicons.eot');
  ...
}

The Cloudfront url is not getting prefixing with full Cloudfront URL (it's missing the subdomain). It looks like this:

https://.cloudfront.net/assets/dripicons-9b4649c1936652d1c1c1d18410b16ebd.eot

I tried using the font_assets gem ( https://github.com/rubymaverick/font_assets ), but it didn't fix the issue. I'm using Rails 3.2.13.

I'd really appreciate any input. Thanks!

If the URL is missing for your font it could be a configuration issue. Please, verify that your environment configuration files (in this case the production.rb one) is correctly configured. From the font_assets guide :

config.font_assets.origin = 'http://coffeescript.codeschool.com'

You should probably an adequate origin URL here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM