Forum Discussion
dlg_23340
Nov 18, 2011Cirrus
variables in a switch statement
What are my options for variable expansion in switch cases? It seems to me that in the following code, when i visit http://example.com/bar/test, I should get "you found foo." for my page content. In...
nitass
Nov 18, 2011Employee
[root@ve1023:Active] config b virtual bar list
virtual bar {
snat automap
pool foo
destination 172.28.19.79:80
ip protocol 6
rules myrule
profiles {
http {}
tcp {}
}
vlans external enable
}
[root@ve1023:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST {
set foo "bar"
switch -glob -- [URI::decode [HTTP::uri]] "
/$foo/* { HTTP::respond 200 content {you found foo.} }
"
}
}
[root@ve1023:Active] config curl -i http://172.28.19.79/bar/abc
HTTP/1.0 200 OK
Server: BigIP
Connection: Keep-Alive
Content-Length: 14
you found foo.
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