02-Jul-2020
16:34
- last edited on
04-Jun-2023
21:23
by
JimmyPackets
Hi there,
It seems that after we upgraded our LTM, part of an iRule stopped working and the error in ltm logs doesn't explain why. I've got an iRule that will redirect an http request if the URI is either "" or "/". It also is supposed to send the request to a certain pool based on hostname. This was working. Now if only does the pool part and ignores the redirect. The ltm log generates this error each time:
Jul 1 17:22:46 bigip10 err tmm[12168]: 01220001:3: TCL error: /Common/CCB_iRule <HTTP_REQUEST> - Can't call after responding - ERR_NOT_SUPPORTED (line 😎 invoked from within "HTTP::host"
The iRule is as follows:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"" -
"/" {
HTTP::redirect /ouaf
}
}
switch [string tolower [HTTP::host]] {
ccbtest.domain.com {
pool ccbqa_pool
}
ccbprod.domain.com {
pool ccbprd_pool
}
default {
log local0. "Unknown site: [HTTP::host]"
}
}
}
Can someone give me some insight as to what I'm doing wrong?
Thanks much for your time...
06-Jul-2020 09:00
1st switch condition. We can club both switch in one statement.
06-Jul-2020
16:10
- last edited on
04-Jun-2023
21:23
by
JimmyPackets
If I try just doing an if statement for the first block, I still get the same error. It's strange that this used to work before the upgrade to 14.x. It's weird because the second switch is still working correctly even when the first entry is there. It just logs something to /var/log/ltm
when HTTP_REQUEST {
if {[HTTP::uri] equals "/"}{
HTTP::redirect "https://ccbprod.domain.com/ouaf"}
switch [string tolower [HTTP::host]] {
ccbtest.domain.com {
pool ccbqa_pool
}
ccbprod.domain.com {
pool ccbprd_pool
}
default {
log local0. "Unknown site: [HTTP::host]"
}
}
}
08-Jul-2020 10:31
I don't know why I didn't see this article before but it appears to explain why it's not working. I had to add a "return" command after the first switch block.