valid_referers directive not working correctly

Igor Sysoev igor at sysoev.ru
Mon Nov 12 09:26:17 UTC 2012


On Nov 12, 2012, at 13:19 , 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 have to copy only

if ($invalid_referer) { return 403; }

The issue is that while the most nginx directive are declarative and
and can be easy inherted, the "if", "rewrite", "set", and "return" are
imperative directives.


--
Igor Sysoev
http://nginx.com/support.html



More information about the nginx mailing list