Search code examples
apachemime-typesfont-face

Error with Font MIME Types on Apache


I'm trying to serve some webfonts, in .otf/.woff/.svg formats. The browser is not rendering the fonts, and I'm seeing the following errors in the Console:

Resource interpreted as Font but transferred with MIME type text/html: "http://localhost/file.woff".
Resource interpreted as Font but transferred with MIME type text/html: "http://localhost/file.otf".
Resource interpreted as Font but transferred with MIME type text/html: "http://localhost/file.svg".

The same set of files works fine on another web server, but not in my local dev environment, so I know it's not a problem with the HTML/CSS/Font Files. I'm running Apache 2.2.22. I've tried many different combinations of AddType directives in both .htaccess files and /etc/apache2/mods-available/mime.conf, but no matter what I continue to get those errors and the fonts don't render. I've tried this in both Chrome and Firefox, and get the same errors and no rendering. What am I missing?


Solution

  • If anyone comes across this, the answer was indeed a server configuration problem, with the AddType directives. The files were not being loaded correctly, so the config was not being loaded.