started with this...
when CLIENT_ACCEPTED {event HTTP_REQUEST enable}
when HTTP_REQUEST {
set MY_HOST [string tolower [HTTP::host]]
set MY_URI [string tolower [HTTP::uri]]
if {$MY_URI starts_with "/abcd/web/abcd.client.web/"} {
if {$MY_HOST equals "m3.companyname.com"} {
HTTP::redirect http://a1.m3.companyname.com$MY_URI
} elseif {$MY_HOST equals "internal.m3.companyname.com"} {
HTTP::redirect http://internal.a1.m3.companyname.com$MY_URI
} elseif {$MY_HOST equals "internal.m3-dc1.companyname.com"} {
HTTP::redirect http://internal.a1.m3-dc1.companyname.com$MY_URI
} elseif {$MY_HOST equals "internal.m3-dc2.companyname.com"} {
HTTP::redirect http://internal.a1.m3-dc2.companyname.com$MY_URI
} elseif {$MY_HOST equals "internal.m3-dc3.companyname.com"} {
HTTP::redirect http://internal.a1.m3-dc3.companyname.com$MY_URI
}
event HTTP_REQUEST disable
TCP::close
}
}
when HTTP_RESPONSE {event HTTP_REQUEST enable}
===================================================================
tried using use "or", f5 accepted it as syntactically correct, but this try didn't work, still redirected the "not" uris...
when CLIENT_ACCEPTED {event HTTP_REQUEST enable}
when HTTP_REQUEST {
set MY_HOST [string tolower [HTTP::host]]
set MY_URI [string tolower [HTTP::uri]]
if {$MY_URI starts_with "/abcd/"} {
if {not ($MY_URI starts_with "/abcd/web/abcdpayment.web/") or not ($MY_URI starts_with "/abcd/web/abcdpaymentprocessing.web/")} {
if {$MY_HOST equals "m3.companyname"} {
HTTP::redirect http://a1.m3.companyname$MY_URI
} elseif {$MY_HOST equals "internal.m3.companyname"} {
HTTP::redirect http://internal.a1.m3.companyname$MY_URI
} elseif {$MY_HOST equals "internal.m3-dc1.companyname"} {
HTTP::redirect http://internal.a1.m3-dc1.companyname$MY_URI
} elseif {$MY_HOST equals "internal.m3-dc2.companyname"} {
HTTP::redirect http://internal.a1.m3-dc2.companyname$MY_URI
} elseif {$MY_HOST equals "internal.m3-dc3.companyname"} {
HTTP::redirect http://internal.a1.m3-dc3.companyname$MY_URI
}
event HTTP_REQUEST disable
TCP::close
}
}
}
when HTTP_RESPONSE {event HTTP_REQUEST enable}
not or not
probably doesn’t mean what you think. Consider
not A or not B
. Assuming that A, B and C are mutually exclusive conditions, the statement
not A or not B
is true under all of the following conditions:
- A is true
- B is true
- C is true
That’s because
not A or not B
is true if: A is not true, if B is not true, or if both are not true. In the first case (
A is true
), B is not true, so the statement matches. In the second case (
B is true
), A is not true, so the statement matches. In the third case, both A and B are not true, so the statement matches. Putting this in terms of your command, consider:
not ($MY_URI starts_with "/abcd/web/abcdpayment.web/") or not ($MY_URI starts_with "/abcd/web/abcdpaymentprocessing.web/")
If
$MY_URI
starts_with “/abcd/web/abcdpayment.web/” this statement actually matches (that is, it evaluates to true) because the condition
not ($MY_URI starts_with "/abcd/web/abcdpaymentprocessing.web/")
is in fact true:
$MY_URI
does NOT start with “/abcd/web/abcdpaymentprocessing.web/”.
You want
not and not
. Consider
not A and not B
. According to this:
-
if A is true, the statement is false (because
not Ais false)
-
if B is true, the statement is false (because
not Bis false)
-
if C is true, the statement is true (because
not Ais true and
not Bis true)
Again, matching against your logic:
not ($MY_URI starts_with "/abcd/web/abcdpayment.web/") and not ($MY_URI starts_with "/abcd/web/abcdpaymentprocessing.web/")
Now, if
$MY_URI
starts with “/abcd/web/abcdpayment.web/”, this statement is false.
Incidentally, this is exactly equivalent to:
not ($MY_URI starts_with "/abcd/web/abcdpayment.web/" or $MY_URI starts_with "/abcd/web/abcdpaymentprocessing.web/")
not or not
probably doesn’t mean what you think. Consider
not A or not B
. Assuming that A, B and C are mutually exclusive conditions, the statement
not A or not B
is true under all of the following conditions:
- A is true
- B is true
- C is true
That’s because
not A or not B
is true if: A is not true, if B is not true, or if both are not true. In the first case (
A is true
), B is not true, so the statement matches. In the second case (
B is true
), A is not true, so the statement matches. In the third case, both A and B are not true, so the statement matches. Putting this in terms of your command, consider:
not ($MY_URI starts_with "/abcd/web/abcdpayment.web/") or not ($MY_URI starts_with "/abcd/web/abcdpaymentprocessing.web/")
If
$MY_URI
starts_with “/abcd/web/abcdpayment.web/” this statement actually matches (that is, it evaluates to true) because the condition
not ($MY_URI starts_with "/abcd/web/abcdpaymentprocessing.web/")
is in fact true:
$MY_URI
does NOT start with “/abcd/web/abcdpaymentprocessing.web/”.
You want
not and not
. Consider
not A and not B
. According to this:
-
if A is true, the statement is false (because
not Ais false)
-
if B is true, the statement is false (because
not Bis false)
-
if C is true, the statement is true (because
not Ais true and
not Bis true)
Again, matching against your logic:
not ($MY_URI starts_with "/abcd/web/abcdpayment.web/") and not ($MY_URI starts_with "/abcd/web/abcdpaymentprocessing.web/")
Now, if
$MY_URI
starts with “/abcd/web/abcdpayment.web/”, this statement is false.
Incidentally, this is exactly equivalent to:
not ($MY_URI starts_with "/abcd/web/abcdpayment.web/" or $MY_URI starts_with "/abcd/web/abcdpaymentprocessing.web/")
I understand. The first example with the “and not”, made it clear. Thanks.
I understand. The first example with the “and not”, made it clear. Thanks.