mahnsc
Apr 06, 2012Nimbostratus
Three Questions on STREAM iRule
I have a web site that is sending a couple different absolute URLs that
required me setting up a couple of STREAM::expression irules. Each rule
worked fine when running under 9.4.3 but when we upgraded to 10.2.3, the
second of the two rules no longer worked. I consolidated the rule into
1, which looks like the irule below:
when RULE_INIT {
set ::crfind "http://host.domain.tld:8443/"
set ::cr2find "http://host.domain.tld:8080/"
set ::crreplace "https://host.domain.tld/"
}
when HTTP_REQUEST {
STREAM::disable
}
when HTTP_RESPONSE {
if {[HTTP::header value Content-Type] contains "text"} {
STREAM::expression "@$::crfind@$::crreplace@"
STREAM::enable
} elseif {[HTTP::header value Content-Type] contains "text"} {
STREAM::expression "@$::cr2find@$::crreplace@"
STREAM::enable
} else {
STREAM::disable
}
}
when STREAM_MATCHED {
log local0. "Matched [STREAM::match]"
}
My first question is: Why does STREAM::match only log the match for
value $::cr2find even though the STREAM::expression for $::crfind works
fine?
My second question is: Why doesn't the second STREAM::expression work for $::cr2find even though STREAM::match is matching it?
My last question is: What is the correct way for me to re-initialize
variable values if I make a change to that value? For example, if I
change the value of $::crfind from "http://host.domain:tld:8443/" to
"https://host.domain.tld:8443/", nothing matches unless I change the name of the variable itself.