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 use hotlink protection in Nginx and it is working very well!

For some reason it is not allowing visitors to my site using Firefox to see any images.
For visitors using IE, Chrome, Safari, and Opera, it works just fine: the images show up on my site but not if you try to hotlink.

I checked Firefox on Win and on Mac and it happens in both places. Headers sent by Firefox have the same referrers as IE and the others as far as I can tell.

The hotlink protection code looks like so

location ~ \.(jpg|jpeg|png|gif|swf)$ {
    valid_referers server_names blocked *.mysite.com;
    if ($invalid_referer) {
        rewrite ^(.*)$ /nopeeking.png break;
    }
}

location =/visitpg.png {
    root /path/to/my/site;
}   

Any ideas as to why this works in all other browsers but not in Firefox?

share|improve this question
    
How did you check the headers from Firefox? Can you give us the headers from a working & non-working browser? –  voretaq7 Jan 22 '12 at 2:08
    
try adding none to valid_referers –  SaveTheRbtz Jan 22 '12 at 12:06
    
Firefox requires adding add_header Access-Control-Allow-Origin *; to your Nginx server block for cross-domain content. Old question here but this may help others. –  Tom Brossman Apr 21 at 9:45

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.