Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to use mod_headers to set a header for certain file types. Specifically, I want to set Access-Control-Allow-Origin to "*" for ttf files. Is there a rule I can add to my VirtualHost that will do this for me?

share|improve this question
up vote 5 down vote accepted

You can use the <Files> tag to do this (docs), i.e.:

<Files "*.ttf">
  Header set Access-Control-Allow-Origin "*"

This will restrict the Header to only files ending in .ttf. Hope this helps!

share|improve this answer
Perfect, thanks! – andrewtweber Dec 12 '11 at 1:49

And, an alternate option:

SetEnvIf Request_URI "\.ttf$" change_header
Header set Access-Control-Allow-Origin "*" env=change_header
share|improve this answer
Is there any reason this would be preferred to the <Files> method? – andrewtweber Dec 12 '11 at 1:50

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.