Hello everyone,
[url=http://wiki.nginx.org/NginxHttpRewriteModule#if]The docs say[/url] that any string starting with a "0" is false. This was causing me problems with the following configuration block:
[code]
location ~ \.php$ {
root $webroot;
if ($cookie_staff)
{
fastcgi_pass 127.0.0.1:9001;
}
if ($cookie_staff = "")
{
fastcgi_pass 127.0.0.1:9000;
}
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/htdocs$fastcgi_script_name;
include fastcgi_params;
}
[/code]
If $cookie_staff happens to start with "0", both IF comparisons return FALSE. This is horribly unintuitive to me, and because I missed that part of the documentation my raw PHP code was being leaked to some users for a long time.
I cannot solve this problem outside of Nginx, since the "staff" cookie is encrypted by PHP-FPM and I have no control over its contents.
My question is: how can I reliably detect the presence of the $cookie_staff, REGARDLESS of whether it begins with a "0" or not? Any advise would be greatly appreciated!
Edited 2 time(s). Last edit at 06/30/2010 11:06PM by robbles.