Problem with Hotlink Protection

dullnicker nginx-forum at nginx.us
Wed Sep 14 15:19:05 UTC 2011


Dear all,

I am having a problem getting hotlinking protection to work. I run an
image gallery on a nginx webserver and would like to achieve that
hotlinking to the images on the website is impossible to save
bandwidth.

I have the following code in my location block:

<-- SNIP --->

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

<-- SNAP -->

That works fine so far. But the problem is that the gallery script
creates image links that look like this:

<-- SNIP --->

http://www.mydomain.com/image.php?twg_album=album-05900-05999&twg_show=image-05995.jpg

<-- SNAP -->

These do not trigger the hotlink protection. I am totally lost and have
no idea how I might be able to protect those image links from
hotlinking.
Any help would be highly appreciated! Thank you all in advance!

Kind regards
-Amitz

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,215198,215198#msg-215198



More information about the nginx mailing list