valid_referers directive not working correctly

Valentin V. Bartenev vbart at nginx.com
Mon Nov 12 09:31:45 UTC 2012


On Monday 12 November 2012 13:19:23 justin wrote:
> Ahh right, so basically I have to copy:
> 
> valid_referers server_names not-my-domain.com;
> if ($invalid_referer) {
>   return 403;
> }
> 
> Into the php match block. Is there a way to do this without having the same
> exact code copied into both location blocks?
> 

You can put it on the server level.

Basically there are two types of rewrite rules:
 - "server" level 
 - "location" specific

For details, see:
http://nginx.org/en/docs/http/ngx_http_rewrite_module.html

 wbr, Valentin V. Bartenev

--
http://nginx.com/support.html
http://nginx.org/en/donation.html



More information about the nginx mailing list