Forum Discussion
Redirect Failure for iRule
A couple things that I noticed:
Looks like your first 2 if...elseif statements are the same (if the test it testssl.communigator.co.uk). I'd consolidate and use a single "switch -glob"
On you switch -glob looking at /Commons, Cory is right about checking needing to make that lowercase or it won't match, but the way you have it, it's looking for a path EXACTLY like "/common/". If you change it to "/common/*" (so it'll check that it starts with /common/ and could have something after that), that may help you out. (Not to mention if you wanted to prepend the /login/, you'd need to update the redirect to ...".co.uk/login[HTTP::uri]"
Does that help at all?
So the new code might look something like this:
when HTTP_REQUEST {
if { [HTTP::host] eq "testssl.communigatormail.co.uk" } {
switch -glob [string tolower [HTTP::path]] {
"/" {
HTTP::redirect "https://testssl.communigator.co.uk/login"
}
"/common/*" {
HTTP::redirect "https://testssl.communigator.co.uk/login[HTTP::uri]"
}
default {
HTTP::redirect "https://testssl.communigator.co.uk/[HTTP::uri]"
}
}
} elseif { [HTTP::host] eq "testssl.communigator.co.uk" } {
switch -glob [string tolower [HTTP::path]] {
"/login/" -
"/lz/*" {
HTTP::redirect "https://testssl.communigator.co.uk[HTTP::uri]"
}
}
}
}Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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