Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Sat Jan 21, 2012 9:30 am 
Offline
Senior Member

Joined: Tue Oct 20, 2009 9:02 am
Posts: 56
I use hotlink protection in Nginx and it is working very well!

For some reason - and the reason for this question - it is not allowing visitors to my site using firefox to see any images, which they should. For IE, Chrome, Safari, and Opera, it works just fine. 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 send the same referres (as far as I can see) as does IE and the others.

The hotlink protection code looks like so

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

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

As I said, this is working very well! Anyone trying to hotlink gets the nopeeking.png image in their face. Fine.

If it wasn't for Firefox.

Any ideas as to why this works in all browsers but not in FF which treats it like it is trying to peek?


Top
   
 Post subject:
PostPosted: Sat Jan 21, 2012 11:43 am 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
I had an issue similar to this, for some reason some firefox browsers do not send a referrer header, add "none" to your valid_referers

_________________
Paid support
How to ask for help
1. Give details of your problem
2. Post any errors
3. Post relevant logs.
4. Don't hide details i.e. your domain, it just makes things harder
5. Be polite or you'll be eaten by a grue


Top
   
 Post subject:
PostPosted: Sat Jan 21, 2012 3:40 pm 
Offline
Senior Member

Joined: Tue Oct 20, 2009 9:02 am
Posts: 56
I'll try that as soon as the traffic is a bit easier than now.
I don't know a good way to refresh this setting in Nginx other than restarting it and I don't really want to do that now.

But thanks much. Your answer makes sense and it's probably what's gone wrong here. Thanks.


Top
   
 Post subject:
PostPosted: Sat Jan 21, 2012 3:50 pm 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
run
Code:
service nginx reload
that will reload the nginx configuration without restarting the server.

_________________
Paid support
How to ask for help
1. Give details of your problem
2. Post any errors
3. Post relevant logs.
4. Don't hide details i.e. your domain, it just makes things harder
5. Be polite or you'll be eaten by a grue


Top
   
 Post subject:
PostPosted: Sun Jan 22, 2012 11:18 am 
Offline
Senior Member

Joined: Tue Oct 20, 2009 9:02 am
Posts: 56
Superb!
Works very well.

Thanks for the tip on how to reload the nginx config, I guess I could've (or rather should have) found it on the nginx wiki.

Thanks just the same.


Top
   
PostPosted: Wed Oct 10, 2012 10:13 am 
Offline
Senior Newbie

Joined: Sat Feb 12, 2011 11:07 am
Posts: 14
I have used this:

location ~ \.(jpg|jpeg|png|gif|swf)$ {
valid_referers server_names blocked *.mydomain.com;
if ($invalid_referer) {
return 403;
}


but I find that the images with

https://

addresses are not showing. Since I have SSL enabled on my website most of the images are not showing...

What should I do?


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group