Forum Discussion
Sahir_180434
Nimbostratus
Kai,
first, Thanks for your effort trying to help on this & you could be right about the rule not being stable. second, as I mentioned before I am an iRules newbie, and have no idea what is this iRule is doing, I was given this project and I am still learning, I am a Cisco guy in first place.
third, I am wondering if you missed an else statement in your suggested code in the following part:
when HTTP_REQUEST {
if { [active_members et-pool] == 0 } {
HTTP::redirect "http://[HTTP::header "X-Forwarded-Host"]/unavailable/etServices.html"
} else {
if { [HTTP::header exists "X-Forwarded-Host"] } {
HTTP::header replace "Host" [HTTP::header "X-Forwarded-Host"]
}
if { [HTTP::cookie exists "em-et"] } {
log local0. "Persisting by cookie em-et, contents are [HTTP::cookie "em-et"]"
} else {
set pool_member [session lookup uie [findstr [HTTP::uri] "jsessionid" 11 "!"]]
if { $pool_member ne "" } {
pool ets_80-pool member $pool_member
log local0. "jsessionID [findstr [HTTP::uri] "jsessionid" 11 "!"] sent to [session lookup uie [findstr [HTTP::uri] "jsessionid" 11 "!"] ]"
} else {
pool ets_80-pool
log local0. "No jsession ID, local balancing the connection..."
}
}
}
}
and is it should be?
when HTTP_REQUEST {
if { [active_members et-pool] == 0 } {
HTTP::redirect "http://[HTTP::header "X-Forwarded-Host"]/unavailable/etServices.html"
} else {
if { [HTTP::header exists "X-Forwarded-Host"] } {
HTTP::header replace "Host" [HTTP::header "X-Forwarded-Host"]
} else{
if { [HTTP::cookie exists "em-et"] } {
log local0. "Persisting by cookie em-et, contents are [HTTP::cookie "em-et"]"
} else {
set pool_member [session lookup uie [findstr [HTTP::uri] "jsessionid" 11 "!"]]
if { $pool_member ne "" } {
pool ets_80-pool member $pool_member
log local0. "jsessionID [findstr [HTTP::uri] "jsessionid" 11 "!"] sent to [session lookup uie [findstr [HTTP::uri] "jsessionid" 11 "!"] ]"
} else {
pool ets_80-pool
log local0. "No jsession ID, local balancing the connection..."
}
}
}
}
Thanks.
Kai_Wilke
Jan 27, 2016MVP
Hi Sahir,
your provided code didn't contain the "else{" on this position. And placing it on this position would make the code structure incomplete. So i highly doubt this needs to be insert...
Note: Basically I've just adjusted your iRule formatings to get a better overview. And then changed just the part which throws the error by adding an additional check. Well, it was hard to resist to not optimize additional parts... ;-)
BTW: Greetings from a Cisco fellow. I'm sitting right now in front of an C2960XR and applying some boring edge configs... ;-)
Cheers, Kai