Welcome! Log In Create A New Profile

Advanced

Is this use of "if" safe?

Posted by SteveySteve 
Is this use of "if" safe?
November 02, 2011 08:47PM
Hi

I have a several groups of unique, back end servers. I would like to redirect a query to one of those groups based on a value present in the query string. From my reading of the Nginx documentation, the only way I can achieve this is using something like:

if ($arg_foo ~* "SmallAndFurry" ) {
proxy_pass http://WebB;
break;
}

if ($arg_foo ~* "LargeAndBald" ) {
proxy_pass http://WebA;
break;
}

I've read (although not entirely understood) the "if is evil" page and considered the use of try_files as an alternative, but since none of the content resides on the Nginx server itself, try_files doesn't sound like something I can use.

Am I safe using if statements in this manner or will I run into problems?

Thank you!

Steve
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 241
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready