Does Not Equal String Question

I have been working on this (sanitized a bit).

when HTTP_REQUEST {

if { ([HTTP::uri] contains “/whateverthisendsupbeing”) and

([IP::client_addr] != “xxx.xxx.xxx.xxx”) } {

HTTP::redirect https://www.chat.com

} elseif { ([HTTP::uri] contains “/whateverthisendsupbeing2”) and

([IP::client_addr] != “xxx.xxx.xxx.xxx”) } {

HTTP::redirect https://www.chat.com

} else {

pool Chat_Pool

}

}

Basically the first two if’s check if there’s is the URL/URI contain /whateverthisendsupbeing and /whateverthisendsupbeing2. If it does, but is not coming from a certain IP address (xxx.xxx.xxx.xxx), then it forwards them to the root URL (which sends them back through the iRule and forwards them to Chat_Pool.

Otherwise, it lets them continue on their way to Chat_Pool.

I am not sure on the syntax for my != check. I looked through the wiki but couldn’t find an example similar to this.

Could someone please take a look at it for me?

Also, is there a way to represent the client addr as a range of IP addresses instead of just one address? So like, xxx.xxx.xxx.0/24.

Thanks

You can use the IP::addr command (Click here) to evaluate single IP addresses or a single subnet against another single IP address or single subnet.

You can perform a logical not using ! or “not”:

Check if x isn’t equal to 2

if { ! (x==2) }{

or in iRules:

Check if x isn’t equal to 2

if { not (x==2) }{

Aaron