What_Lies_Bene1
Feb 01, 2006Cirrostratus
Combining Logical Operators
Hi all. Hope you're all well.
I'd like to reduce some scripts I have that are used to restrict and redirect traffic. Access is based on domain name and client IP address. We've multiple domain names pointing to a single VS and restricted URI's too, as well as multiple clients, none of whom should see each others sites.
So, I've got something like that below. We check the IP against the data group and then evaluation the host and uri. Based on the results we redirect accordingly. Then we have to do the same for every different host and every different uri. A nightmare.
It's never gonna be great (we're simply running too much through a single VS) however, I'm sure some of the checks could be reduced. For instance [matchclass [IP::client_addr] equals $::AAA_HOSTS or BBB_HOSTS or CCC_HOSTS]. Is it possible?
(We can combine the data groups by the way, we'd lose track of who's who - unless we could reference data groups from within data groups??)
if {[matchclass [IP::client_addr] equals $::AAA_HOSTS] && "[HTTP::host]" equals "HOSTA" && "[HTTP::uri]" equals "/"}
{
log local0. "blah blah"
HTTP::redirect https://blah blah
}
elseif {[matchclass [IP::client_addr] equals $::BBB_HOSTS] && "[HTTP::host]" equals "HOSTA" && "[HTTP::uri]" equals "/"}
{
HTTP::redirect https://somewhere else
}
if
Thanks in advance