2

I'm developing a new template, based on RWD and when I try to load a font file, with extension woff, from:

http://www.example.com/skin/frontend/mytheme/mytheme/fonts/myfont.woff

I get an error report like this:

enter image description here

Inside the error report I get this:

a:5:{i:0;s:52:"Front controller reached 100 router match iterations";i:1;s:456:"#0 /var/www/vhosts/example.com/app/code/core/Mage/Core/Controller/Varien/Front.php(179): Mage::throwException('Front controlle...')
#1 /var/www/vhosts/example.com/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#2 /var/www/vhosts/example.com/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#3 /var/www/vhosts/example.com/index.php(83): Mage::run('default', 'store')
#4 {main}";s:3:"url";s:61:"/skin/frontend/mytheme/mytheme/fonts/myfont.woff";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:7:"default";}

Notes:

  • Magento 1.9.2.2
  • File exists under the folder structure path.
  • Nginx as webserver. Not sure if this may be somehow related.
  • Nginx mime.types file does include the woff file as application/font-woff woff;

Solution

As pointed by @MarioNigrele, the problem was Nginx trying to serve the URL as a PHP request. So adding the next block to my Nginx configuration solved the issue:

location /skin/ {
   location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {
       access_log off;
       try_files $uri =404;
   }
}
  • I am not sure what are you doing, but your font should be placed in skin folder and called from xml (addItem). Please add more info how you are calling font.wof file? – Adarsh Khatri Jan 19 '16 at 2:21
  • Adarsh the file is getting included in the CSS. Regardless the way of inclusion, if I try to hit the URL on the browser, I get the error. The file is there in the folder. – J Plana Jan 19 '16 at 17:06
3

Seems to be an nginx issue, nginx is treating that request like a php one then is routed to app (index.php), please find this file:

/usr/local/nginx/conf/mime.types

and check if all mime types are configured (you shoud see something like this):

font/ttf                      ttf;
font/opentype                 otf;
application/font-woff         woff;
application/vnd.ms-fontobject eot;

(plus) If are using different domains for media and/or skin you'll need to add this code (replacing * for the allowed domains)

location ~* \.(eot|ttf|woff|woff2)$ {
    add_header Access-Control-Allow-Origin *;
}
  • Thanks for the reply. I'm using CentOs, and my mime.types file does contain the woff file extension as follows: application/font-woff woff; – J Plana Jan 19 '16 at 17:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.