Forum Discussion
Michael_Jenkins
Feb 23, 2015Cirrostratus
From 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
}
}