Serving fonts with correct mime types

Update: This was added in nginx 1.3 officially. You may still use this article if mime.types file is not uptodate on your nginx-server.

On a nginx site, for font files, especially woff version, we ran into issues.

Browser console was showing warnings like:

Resource interpreted as Font but transferred with MIME type font/x-woff
Resource interpreted as Font but transferred with MIME type font/font-woff

Solution

Open /etc/nginx/mime.types

Add following lines in it:

application/font-woff           woff; 
application/x-font-woff         woff;

Save file.

Reload nginx. (service nginx reload)