Nginx font rules

Linode Staff


Some fonts aren't loading from my Linode.

I set up these rules in my nginx configuration:

location ~* .(eot|css|otf|ttf|woff)$ {
add_header Access-Control-Allow-Origin *;

I keep getting an error stating "No 'Access-Control-Allow-Origin' header is present"

Is there something I should be adding to my configuration to make this work?


2 Replies

I would first check to see if your fonts have default mime types. By default, NGINX has no mime types for fonts. This could be related to the error you received.

To check, navigate to the directory with your configs and locate where the mime types are defined. Typically they are located in the mime.types file. If haven't already done so, you may need to add these strings below to that file:

application/x-font-ttf ttc ttf;
application/x-font-otf otf;
application/font-woff woff;
application/font-woff2 woff2;
application/ eot;

If the error you are receiving is related to being blocked by CORS policy, try adding this to your vhost configuration:

location ~* .(eot|otf|ttf|woff|woff2)$ {
add_header Access-Control-Allow-Origin *;

For more information in reagrds to proper NGINX font configurations, check out these links below:


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct