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"
...
Yann_Desmarest
Cirrus
Mar 29, 2016Hello,
The switch condition are taken in the order, so you can define a /dir1* but after /dir1/dir2* for example.
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::path]] {
"/dir1/dir2*" {
HTTP::respond 301 Location "http://www.domain2.com"
}
"/dir1*" {
HTTP::respond 301 Location "http://www.domain1.com"
}
}
}
Yann_Desmarest
Cirrus
Mar 29, 2016What is the logic behind your redirect links ?
Maybe, you can extract patterns from your request uri and change the Location value accordingly with a string map command
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