Search code examples
nginxruby-on-rails-4firefoxfont-face

Rails computes wrong asset domain for fonts only, firefox can't download


For some reason the fonts are the only assets that are loaded from the http://example.com domain instead of http://www.example.com, and because of this, are not displayed in Firefox because of CORS.

this is the less file that loads the fonts:

@font-face {
  font-family: 'example';
  src: asset-url('example.eot?97822167');
  src: asset-url('example.eot?97822167#iefix') format('embedded-opentype'),
   asset-url('example.woff?97822167') format('woff'),
   asset-url('example.ttf?97822167') format('truetype'),
   asset-url('example.svg?97822167#example') format('svg');
 font-weight: normal;
 font-style: normal;
}

Firefox says:

downloadable font: download failed (font-family: "example" style:normal weight:normal stretch:normal src index:2): bad URI or cross-site access not allowed
source: http://example.com/assets/example-c93f82c639ee9474376d8df30300127a.ttf?97822167

The asset host is set to www.example.com. why is the domain wrong? how can i change this?

Thank you


Solution

  • changed

    asset-url 
    

    to

    asset_url 
    

    in the .less file and all was well