Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I like NGINX but how do I set the Access-Control-Allow-Origin header so I can use web-fonts from my subdomain on my main domain?

share|improve this question
ah finally found the answer location / { add_header Access-Control-Allow-Origin "*"; } –  Chris McKee Jul 20 '10 at 22:59

1 Answer 1

up vote 38 down vote accepted

Nginx has to be compiled with http://wiki.nginx.org/NginxHttpHeadersModule. Then you can do this

location ~* \.(eot|ttf|woff)$ {
    add_header Access-Control-Allow-Origin *;
share|improve this answer
Follow this instructions in case you want want to implement the same solution on apache: stackoverflow.com/questions/11616306/… –  camilo_u Feb 5 '13 at 16:46
NOTE: If the given solution doesn't work for you, read this and this. It's enlightening, and you may find the reason it isn't working. –  its_me Feb 28 '13 at 8:20
This link helped me out: gist.github.com/michiel/1064640 –  meawoppl Sep 17 '13 at 2:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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