valid_referers problem

Todd HG lists at ruby-forum.com
Sun Oct 24 00:06:27 MSD 2010


I am using valid_referers to detect image hotlinking. Invalid referers
are forwarded to the homepage, however, I have since changed the address
for images from images.hollywoodgrind.com:9000 to
www.hollywoodgrind.com.

The last line contains the rewrite rule 'rewrite ^
http://www.hollywoodgrind.com$request_uri? permanent;', which would
forward traffic going to images.hollywoodgrind.com:9000 to it's new
exact location at www.hollywoodgrind.com.

What I'd like is for invalid traffic to be forwarded to the home page
located at www.hollywoodgrind.com, but for valid traffic to be forwarded
to the new url location for the image.

server {
    listen       9000;
    server_name  images.hollywoodgrind.com;
    location /images {
      valid_referers blocked ~\.google\. ~\.yahoo\. ~\.bing\. ~\.ask\.
~\.live\. ~\.googleusercontent.com\. www.hollywoodgrind.com
feeds.hollywoodgrind.com/HollywoodGrind
feeds2.feedburner.com/HollywoodGrind images.google.com 209.85.171.104
google.com www.google.com yahoo.com my.yahoo.com
feedproxy.google.com/HollywoodGrind images.search.yahoo.com live.com
search.live.com 209.85.173.132 ask.com images.ask.com
translate.googleusercontent.com googleusercontent.com bing.com;
        if ($invalid_referer) {
        rewrite  ^(.*)$  http://www.hollywoodgrind.com/;
      }
    rewrite ^ http://www.hollywoodgrind.com$request_uri? permanent;
    }
}

-- 
Posted via http://www.ruby-forum.com/.



More information about the nginx mailing list