Question on Rewrite / If statements

Igor Sysoev is at rambler-co.ru
Fri Sep 18 15:33:29 MSD 2009


On Wed, Sep 16, 2009 at 08:03:26PM -0500, Resicow wrote:

> 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?

Yes, "if" is ugly hack and it does not evaluate a right part of expression.

What task do you want to resolve using $http_referer ?


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





More information about the nginx mailing list