Forum Discussion
Feb 25, 2015
BIG-IP : irule wildcard for redirect location
F5 BIG-IP Virtual Edition v11.4.1 (Build 635.0) LTM on ESXi
Are iRule wildcards smart enough to transfer across from a match-path to a redirect location ?
Does this work ?
switch -glob [string tolower [HTTP::host]] {
"www.mysite.com" {
switch -glob [string tolower [HTTP::uri]] {
"/old-path*" {
HTTP::respond 301 Location "/new-path*"
}
8 Replies
- JG
Cumulonimbus
Yes, they are. See https://devcentral.f5.com/articles/irules-101-04-switch .
- Torti
Cirrus
the switch looks good, but the Location of the respond doesn't. it doesn't allow a wildcard.
- so Jie answer is incorrect ?
- Torti
Cirrus
I think, his answer is only for the switch command
- Torti_93733
Nimbostratus
the switch looks good, but the Location of the respond doesn't. it doesn't allow a wildcard.
- so Jie answer is incorrect ?
- Torti_93733
Nimbostratus
I think, his answer is only for the switch command
- JG
Cumulonimbus
You could do something like the following:
switch -glob [string tolower [HTTP::host]] { "www.mysite.com" { switch -glob [string tolower [HTTP::uri]] { "/old-path*" { set new_uri [string map {"/old-path" "/new-path" } [HTTP::uri]] HTTP::respond 301 Location "$new_uri" } } } }
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