Forum Discussion
Joe_Pipitone
Nimbostratus
May 12, 2010Redirects / rewrites conflicting
I have a master iRule which seems to be throwing a "Multiple redirect/respond invocations now allowed"
The iRule is as follows. It tries to match certain urls typed in by the user, and redirects. Another part of the rule simply says if the uri begins with images, then rewrite to legacy.oursite.com/images. The 3rd part of the iRule strips the www from the domain.
The errors I am getting are:
TCL error: redmond_redirects HTTP_REQUEST -
Operation not supported. Multiple redirect/respond
invocations not allowed line 1 invoked from within
HTTP::redirect http://oursite.com[HTTP::uri] default arm line 1
invoked from within switch -glob [HTTP::uri] { / {
HTTP::redirect http://oursite.com } default { HTTP::redirect
http://oursite.com...
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] equals "/survey" or [string tolower [HTTP::uri]] equals "/survey/" } {
HTTP::redirect "http://oursite.com/surveys/"
}
if { [string tolower [HTTP::uri]] equals "/surveys" } {
HTTP::redirect "http://oursite.com/newsurveys/"
}
if { [string tolower [HTTP::uri]] equals "/anotherurl/survey2008" or [string tolower [HTTP::uri]] equals "/anotherurl/survey2008/" } {
HTTP::redirect "http://oursite.com/whitepapers/2009/05/survey.aspx"
}
if { [string tolower [HTTP::uri]] starts_with "/anotherurl/survey2007" or [string tolower [HTTP::uri]] equals "/anotherurl/survey2008/" } {
HTTP::redirect "http://oursite.com/whitepapers/2009/05/2007survey.aspx"
}
if { [string tolower [HTTP::uri]] equals "/subscribe" or [string tolower [HTTP::uri]] equals "/subscribe/" } {
HTTP::redirect "https://some.domain.com/sub/MI?WP=PCODE"
}
set my_uri [string tolower [HTTP::uri]]
if { $my_uri starts_with "/images" } {
redirect to oursite.com/images on matching URI
HTTP::redirect http://legacy.oursite.com$my_uri
}
if { ([HTTP::host] eq "www.oursite.com") } {
switch -glob [HTTP::uri] {
"/" { HTTP::redirect "http://oursite.com" }
default { HTTP::redirect "http://oursite.com[HTTP::uri]" }
}
}
}
Can anyone help me resolve these errors?- Jose_Santiago_O
Nimbostratus
Hi Joe, - Joe_Pipitone
Nimbostratus
Well, the problem with that is - I always want the www to be stripped - so if it catches http://www.oursite.com/survey it will redirect to the correct URL, however it will leave the www in the url. - Jose_Santiago_O
Nimbostratus
Hi Joe, - Joe_Pipitone
Nimbostratus
Right - I understand completely. How can I also make sure that the www is taken out of the url? This needs to also happen. - Jose_Santiago_O
Nimbostratus
Can you try this:when HTTP_REQUEST { if { ([HTTP::host] eq "www.oursite.com") } { HTTP::redirect "http://oursite.com[HTTP::uri]" return } switch -glob [string tolower [HTTP::uri]] { "/survey" - "/survey/" { HTTP::redirect "http://oursite.com/surveys/" return } "/surveys" { HTTP::redirect "http://oursite.com/newsurveys/" return } "/anotherurl/survey2008" - "/anotherurl/survey2008/" { HTTP::redirect "http://oursite.com/whitepapers/2009/05/survey.aspx" return } "/anotherurl/survey2007" { HTTP::redirect "http://oursite.com/whitepapers/2009/05/2007survey.aspx" return } "/images*" { HTTP::redirect "http://legacy.oursite.com[HTTP::uri]" return } } }
- Joe_Pipitone
Nimbostratus
Jose - it worked GREAT!!!!! Thank you so much for your help once again. - Jose_Santiago_O
Nimbostratus
No problem :o)
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