Poste novamente comentário de Pothi como CW
If
não é mal , se usado fora de um bloco location
! Mesmo dentro de um bloco location
, ele pode ser usado com as diretivas return
e rewrite
!
Snippet da página IfIsEvil
Directive
if
has problems when used inlocation
context, in some cases it doesn't do what you expect but something completely different instead. In some cases it even segfaults. It's generally a good idea to avoid it if possible.The only 100% safe things which may be done inside if in
location
context are:return ...; rewrite ... last;
Anything else may possibly cause unpredictable behaviour, including potential SIGSEGV.