Forum Discussion
Daniel_Ma_23954
Nimbostratus
Feb 09, 2016Redirect both host and path via iRules
I"m fairly new to using iRules and writing redirects, but currently I have a redirect in place that does http to https redirect via the switch parameter for different host names, see below.
when H...
Daniel_Ma_23954
Nimbostratus
Feb 09, 2016The nested switch statements seems to be working correctly, as all the conditions are redirecting to the correct https URLs when it's a http request.
However, in my case, I also need to redirect those same conditions when it's a https request. Below is what I have so far:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"/example" {
HTTP::redirect "/site1/example"
}
"/example2" {
HTTP::redirect "/site2/example"
}
default {
reject
}
}
}In the above code, I'm having some issues with the default. I've tried using reject and leaving it blank, neither seems to work properly. The default should just go to the main site. How can I accomplish this?
Thanks again for the help
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