Forum Discussion
Stuart_Feather1
Sep 23, 2014Nimbostratus
iRule error - Multiple redirect/respond invocations not allowed
I have an existing iRule that redirects any requests to our root site (http://abc.com) to be redirected to www.abc.com. Simplified example of the iRule below.
when HTTP_REQUEST {
if { ([HTTP...
- Sep 23, 2014
Since the logic is somewhat related (redirect logic), why not merge the two iRules into something like:
when HTTP_REQUEST { switch [HTTP::uri] { "/Page1.php" { HTTP::respond 301 Location "http://www.abc.com/Page1.aspx" } "/Page2.php" { HTTP::respond 301 Location "http://www.abc.com/Page2.aspx" } default { if { ([HTTP::host] equals "abc.com" ) } { HTTP::respond 301 Location "http://www.abc.com[HTTP::uri]" } } } }
shaggy
Nimbostratus
Since the logic is somewhat related (redirect logic), why not merge the two iRules into something like:
when HTTP_REQUEST {
switch [HTTP::uri] {
"/Page1.php" {
HTTP::respond 301 Location "http://www.abc.com/Page1.aspx"
}
"/Page2.php" {
HTTP::respond 301 Location "http://www.abc.com/Page2.aspx"
}
default {
if { ([HTTP::host] equals "abc.com" ) } {
HTTP::respond 301 Location "http://www.abc.com[HTTP::uri]"
}
}
}
}
Stuart_Feather1
Sep 23, 2014Nimbostratus
I think that sounds like a good idea, I'll give that a try. Thanks shaggy!
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