Forum Discussion
If-Then-Else within a Switch
Hi everyone. I had a question about a rule I recently wrote. Initially, I had a rule that comprised a switch -glob statement with a bunch of URIs that, when a match occurs, would route traffic to a particular pool. One of our customers was having issues with some web services which went away once I added ONECONNECT::reuse disable to the affected URI like so:
"/web/services/*" {
ONECONNECT::reuse disable
pool $ws_pool_1
}
The problem they were having was intermittent connection resets after a period of inactivity, (for example, if an hour passed between their requests). We could tell from sniffer traces that their request would never actually get to the web servers from the BigIP and assumed that this was a oneconnect (ghosted connection) issue. Adding the ONECONNECT::reuse disable command fixed the problem for this customer.
Months later, another customer using the same set of services began suffering unrelated problems after an upgrade went in so I had to modify the rule to route traffic to one pool (running the old code) if their IP address was matched and all other users get routed to the new pool. I modified the rule like so:
"/web/services/*" {
ONECONNECT::reuse disable
if { ( [IP::addr [IP::client_addr] equals 111.222.333.444] ) }{
pool $ws_pool_1
} else {
pool $ws_pool_2
}
}
Subsequent to this change going in, the first customer began experiencing intermittent connectivity failures again. The logic that routes to a particular pool works fine but I suspect that where I have placed the ONECONNECT::reuse disable command is causing it to be ignored. Should this be placed before the pool command within each branch of the If | Else block? I was assuming, possibly incorrectly, that positioning it before the block would have made it valid regardless of the pool requests were being routed to. If someone could help me understand it better, that would be great.
Recent Discussions
Related Content
* 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