Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 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 *;
    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 '14 at 9:45

Your Answer


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

Browse other questions tagged or ask your own question.