Forum Discussion
f5_rocks
May 06, 2016Nimbostratus
Trying to correctly fformat multiple not statements
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}
probably doesn't mean what you think. Considernot or not
. Assuming that A, B and C are mutually exclusive conditions, the statementnot A or not B
is true under all of the following conditions:not A or not B
- A is true
- B is true
- C is true
That's because
is true if: A is not true, if B is not true, or if both are not true. In the first case (not A or not B
), B is not true, so the statement matches. In the second case (A 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:B is true
not ($MY_URI starts_with "/abcd/web/abcdpayment.web/") or not ($MY_URI starts_with "/abcd/web/abcdpaymentprocessing.web/")
If
starts_with "/abcd/web/abcdpayment.web/" this statement actually matches (that is, it evaluates to true) because the condition$MY_URI
is in fact true:not ($MY_URI starts_with "/abcd/web/abcdpaymentprocessing.web/")
does NOT start with "/abcd/web/abcdpaymentprocessing.web/".$MY_URI
You want
. Considernot and not
. According to this:not A and not B
- if A is true, the statement is false (because
is false)not A
- if B is true, the statement is false (because
is false)not B
- if C is true, the statement is true (because
is true andnot A
is true)not B
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
starts with "/abcd/web/abcdpayment.web/", this statement is false.$MY_URI
Incidentally, this is exactly equivalent to:
not ($MY_URI starts_with "/abcd/web/abcdpayment.web/" or $MY_URI starts_with "/abcd/web/abcdpaymentprocessing.web/")
- Vernon_97235Historic F5 Account
probably doesn't mean what you think. Considernot or not
. Assuming that A, B and C are mutually exclusive conditions, the statementnot A or not B
is true under all of the following conditions:not A or not B
- A is true
- B is true
- C is true
That's because
is true if: A is not true, if B is not true, or if both are not true. In the first case (not A or not B
), B is not true, so the statement matches. In the second case (A 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:B is true
not ($MY_URI starts_with "/abcd/web/abcdpayment.web/") or not ($MY_URI starts_with "/abcd/web/abcdpaymentprocessing.web/")
If
starts_with "/abcd/web/abcdpayment.web/" this statement actually matches (that is, it evaluates to true) because the condition$MY_URI
is in fact true:not ($MY_URI starts_with "/abcd/web/abcdpaymentprocessing.web/")
does NOT start with "/abcd/web/abcdpaymentprocessing.web/".$MY_URI
You want
. Considernot and not
. According to this:not A and not B
- if A is true, the statement is false (because
is false)not A
- if B is true, the statement is false (because
is false)not B
- if C is true, the statement is true (because
is true andnot A
is true)not B
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
starts with "/abcd/web/abcdpayment.web/", this statement is false.$MY_URI
Incidentally, this is exactly equivalent to:
not ($MY_URI starts_with "/abcd/web/abcdpayment.web/" or $MY_URI starts_with "/abcd/web/abcdpaymentprocessing.web/")
- f5_rocksNimbostratusI understand. The first example with the "and not", made it clear. Thanks.
- VernonWellsEmployee
probably doesn't mean what you think. Considernot or not
. Assuming that A, B and C are mutually exclusive conditions, the statementnot A or not B
is true under all of the following conditions:not A or not B
- A is true
- B is true
- C is true
That's because
is true if: A is not true, if B is not true, or if both are not true. In the first case (not A or not B
), B is not true, so the statement matches. In the second case (A 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:B is true
not ($MY_URI starts_with "/abcd/web/abcdpayment.web/") or not ($MY_URI starts_with "/abcd/web/abcdpaymentprocessing.web/")
If
starts_with "/abcd/web/abcdpayment.web/" this statement actually matches (that is, it evaluates to true) because the condition$MY_URI
is in fact true:not ($MY_URI starts_with "/abcd/web/abcdpaymentprocessing.web/")
does NOT start with "/abcd/web/abcdpaymentprocessing.web/".$MY_URI
You want
. Considernot and not
. According to this:not A and not B
- if A is true, the statement is false (because
is false)not A
- if B is true, the statement is false (because
is false)not B
- if C is true, the statement is true (because
is true andnot A
is true)not B
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
starts with "/abcd/web/abcdpayment.web/", this statement is false.$MY_URI
Incidentally, this is exactly equivalent to:
not ($MY_URI starts_with "/abcd/web/abcdpayment.web/" or $MY_URI starts_with "/abcd/web/abcdpaymentprocessing.web/")
- f5_rocksNimbostratusI understand. The first example with the "and not", made it clear. Thanks.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects