Forum Discussion
Branden_35485
Jun 14, 2012Nimbostratus
LTM v11 iRule Migration
I am trying to upgrade a customer to a new LTM box running v11. There current box is running v10.1.2. The iRule that they use is not working correctly on v11 or v10.2.3. What happens is ...
hoolio
Jun 14, 2012Cirrostratus
Hi Branden,
There's a lot going on with that iRule. I'd start by making sure you have a OneConnect profile enabled on the virtual server. If you have SNAT enabled on the virtual server, you can use the default OneConnect profile with a /0 source mask. Else, create a custom OneConnect profile with a /32 source mask. If you still see issues with the iRule, try enabling debug and check the output in /var/log/ltm when a failure occurs.
That said, there are a few issues/oddities with the iRule:
1. This condition will never be true as you're setting the URI to lowercase and then checking for a mixed case string:
([string tolower [HTTP::uri]] contains "GISOasis/Login.aspx?Logout=true")
You can replace that whole section with a switch statement to avoid repeating the same [string tolower...] operation on the URI:
Set the node and URL to the value contained in the cookie
switch -glob [string tolower [HTTP::uri]] {
"*mastermenu*" -
"*gisoasis/login.aspx?logout=true*" -
"*oasisaccounting*" -
"*oasisclaims*" -
"*drc[0-9][0-9][0-9][0-9][0-9]* {
2. The iRule combines HTTP payload collection with a stream profile. You should either do one or the other but not both. For payload rewriting only, it's more efficient to just use a stream profile. If you need to insert a cookie based on the payload content, I think you'll need to collect the payload.
3. If the response is a 404, you can just redirect the request and skip the rest of the response logic. So you could move this section to the top of HTTP_RESPONSE and add a return statement to avoid the rest of the code:
when HTTP_RESPONSE {
Check if response is a 404 error code and redirect to gis.grinnellmutual.com if it is
if { [HTTP::status] == 404} {
HTTP::redirect "https://gis.grinnellmutual.com"
return
}
Aaron
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