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

Just transferred my site from a shared hosting to Linode's VPS, and I'm also completely new to nginx, so please don't be harsh if I missed something evident ^^

I've got my WordPress site running pretty well on nginx & MaxCDN, but my @font-face fonts (served from cdn.domain.com) stopped working in IE9 and FF (@font-face failed cross-origin request. Resource access is restricted.)

I've googled for hours and tried adding all of the following to my config files:

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


location ^/fonts/ { 
    add_header Access-Control-Allow-Origin *; 
}


location / { 
    if ($request_filename ~* ^.*?/([^/]*?)$) 
    { 
        set $filename $1; 
    } 

    if ($filename ~* ^.*?\.(eot)|(otf)|(ttf)|(woff)$){ 
        add_header 'Access-Control-Allow-Origin' '*'; 
    } 
}

Of course, I've restarted nginx after every change.

The headers just don't get sent at all no matter what I do.

I have the default Ubuntu apt-get build nginx which should include the headers module by default... How do I check what modules are installed, or what else could be causing this error?

UPDATE:

I've tried running curl -I [location-of-the-font] and it does return Access-Control-Allow-Origin: * but the header is not visible in Chrome's Network panel and the fonts still don't work in FF & IE9 (CSS3117: @font-face failed cross-origin request. Resource access is restricted.) - Any ideas what could be causing this?

share|improve this question

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.