Forum Discussion
Joe_Pipitone
Nimbostratus
Jul 29, 2010[SOLVED] iRule redirect loop problem
I have an iRule which is only partially working. Can anyone tell me why putting the following in place results in a redirect loop? It does the job partially by stripping the www, however if you try to browse to oursite.com/salarysurvey or oursite.com/salarysurveys it results in a redirect loop.
when HTTP_REQUEST {
if { ([HTTP::host] eq "www.oursite.com") } {
HTTP::redirect "http://oursite.com[HTTP::uri]"
return
}
switch -glob [string tolower [HTTP::uri]] {
"/salarysurvey" -
"/salarysurvey/" {
HTTP::redirect "http://oursite.com/salarysurveys/"
return
}
"/salarysurveys" -
"/salarysurveys/" {
HTTP::redirect "http://oursite.com/salarysurveys/"
return
}
"/images*" {
HTTP::redirect "http://legacy.oursite.com[HTTP::uri]"
return
}
}
}
- Chris_Miller
Altostratus
Unless I'm missing something - this would do this in a much easier fashion.when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "/salarysurvey" - "/salarysurvey/" - "/salarysurveys" - "/salarysurveys/" { HTTP::redirect "http://oursite.com/salarysurveys/" } "/images*" { "http:://legacy.oursite.com[HTTP::uri]" } } if { [HTTP::host] eq "www.oursite.com" } { HTTP::redirect "http://oursite.com[HTTP::uri]" } }
- Chris_Miller
Altostratus
ignore that "nofollow" stuff -forum software doesn't like the link. - Joe_Pipitone
Nimbostratus
Same thing, still results in a redirect loop that will never finish according to Firefox and Chrome - IE doesn't even display the page at all. Any ideas? - Joe_Pipitone
Nimbostratus
The reason for the redirect loop - for some reason the F5 didn't like the fact that I was trying to catch /salarysurveys and /salarysurveys/ - as soon as I removed the one with the trailing slash, it started working fine. - Chris_Miller
Altostratus
Posted By Joe Pipitone on 07/29/2010 01:55 PM
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