Forum Discussion
William_Franz_1
Nimbostratus
Feb 23, 2015iRule- Operation not supported. Multiple redirect/respond invocations not allowed
Hello community, I'm by know means a Tcl expert and I normally only handle generic type of scripts. I've searched around regarding the error in the subject and I've adjusted the script to the bes...
Michael_Jenkins
Cirrostratus
Feb 23, 2015From the error message you're mentioning, that generally means there's multiple locations that are executing an
HTTP::respond (or HTTP::redirect). Do you have other iRules associated that are doing any redirects as well? This happens because the iRules don't stop processing when the respond command executes.
Also, concerning your iRule, regex expressions are expensive (and you should use a variable instead of reusing the
string tolower command), so minimizing their usage is ideal. Perhaps updating your iRule to use something like this may help:
when HTTP_REQUEST {
set uri [string tolower [HTTP::uri]]
set invoke 0
switch -glob -- $uri {
"*/connect/beachbody-challenge/pledge*" {
incr invoke
set newUri [string map -nocase {/connect/beachbody-challenge/pledge /beachbody-challenge/participate-commit-now"} $uri]
}
"*/connect/beachbody-challenge/entry*" {
incr invoke
set newUri [string map -nocase {/connect/beachbody-challenge/entry /beachbody-challenge/enter-contest"} $uri]
}
"*/connect/beachbody-challenge/winners-monthly*" {
incr invoke
set newUri [string map -nocase {/connect/beachbody-challenge/winners-monthly /beachbody-challenge/contest-info-and-contest-winners"} $uri]
}
"*/connect/beachbody-challenge/winners-quarterly*" {
incr invoke
set newUri [string map -nocase {/connect/beachbody-challenge/winners-quarterly /beachbody-challenge/contest-info-and-contest-winners"} $uri]
}
"*/connect/beachbody-challenge/winners-final*" {
incr invoke
set newUri [string map -nocase {/connect/beachbody-challenge/winners-final /beachbody-challenge/contest-info-and-contest-winners"} $uri]
}
"*/connect/beachbody-challenge/vote/quarterly*" {
incr invoke
set newUri [string map -nocase {/connect/beachbody-challenge/vote/quarterly /beachbody-challenge/vote/quarterly"} $uri]
}
"*/connect/beachbody-challenge*" {
incr invoke
set newUri [string map -nocase {/connect/beachbody-challenge /beachbody-challenge"} $uri]
}
}
if {$invoke} {
HTTP::respond 301 Location https://[HTTP::host]$newUri Connection Close
This will ensure other events don't fire, and your response will cause a new connection (so that the next request will execute all desired events)
event disable all
return
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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