How to disable valid_referers?

Igor Sysoev igor at sysoev.ru
Wed Nov 10 16:36:28 MSK 2010


On Wed, Nov 10, 2010 at 09:27:58PM +0800, Horus Lee wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi guys,
> 
> Say if I have many files under / (document root), all of them need
> hotlink protection, except one.
> 
> I set valid_referers for location / as default, how could I skip the
> proection for the specific file?
> 
> I guess I can't simply put "valid_referers none" here according to the
> documentation at http://wiki.nginx.org/HttpRefererModule (It says
> default: none, but I guess this will confuse people with the value "none").

valid_referers  ...;

root ...;

location / {
    if ($invalid_referer) {
        return 403;
    }
}

location = /some.specfic.file {
}

location = /other.specfic.file {
}


-- 
Igor Sysoev
http://sysoev.ru/en/



More information about the nginx mailing list