Question on Rewrite / If statements

Resicow resicow at gmail.com
Thu Sep 17 05:03:26 MSD 2009


Hello,

I have learned that the http_referer module does *not* support variables.

I am trying to work around this with if / rewrite statements, but may 
have run into the same issue.

How can I make this work?

set $myvar mydomain.com;
if ($http_referer ~* $myvar) {
do something
}

When I run that, it always returns false. However this works:

if ($http_referer ~* mydomain.com) {
do something
}

It appears that the if statement doesn't evaluate the variable. Is there 
anyway around this?

Thanks,

John





More information about the nginx mailing list