Problem with Hotlink Protection

dullnicker nginx-forum at
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

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 --->

<-- 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
Any help would be highly appreciated! Thank you all in advance!

Kind regards

Posted at Nginx Forum:,215198,215198#msg-215198

More information about the nginx mailing list