NGinx : How to test if a cookie is set or not without using 'if'?

Viewed 13417

I am using the following configuration for NGinx currently to test my app :

location / {
            # see if the 'id' cookie is set, if yes, pass to that server.           
            if ($cookie_id){
                proxy_pass http://${cookie_id}/$request_uri;                
                break;
            }

            # if the cookie isn't set, then send him to somewhere else
            proxy_pass http://localhost:99/index.php/setUserCookie;
        }

But they say "IFisEvil". Can anyone show me a way how to do the same job without using "if"?
And also, is my usage of "if" is buggy?

1 Answers
Related