Forum Discussion
ShinRyuX
Nimbostratus
Mar 29, 2016Any way to shorten this switch case iRule?
Here is my iRule.
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::path]] {
"/dir1" -
"/dir1/" {
HTTP::respond 301 Location "http://www.domain1.com"
...
Hannes_Rapp
Nimbostratus
Mar 29, 2016Use -glob flag if you have wildcards or other expressions. With your current iRule, the -glob flag is not mandatory.
You may also want to have a look at LTM Local Traffic policy feature. I'd use a Local Traffic Policy over iRules these days whenever possible.
When it comes to shortening the iRule, Yann got the same solution posted a bit before me (removed mine)
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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