Forum Discussion
Keith_Richards_
Nimbostratus
Jun 22, 2008switch for redirects
I am trying to redirect some URIs, and direct others to a pool. The following rule will not issue an HTTP redirect (TMOS 9.4.4)
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri] ] {
"/app1*" { HTTP::redirect "https://www.company.com/PRODapp1" }
"/app2*" { HTTP::redirect "https://www.company.com/COMPANY/" }
"/app3*" { pool pool_app3 }
"/COMPANY*" { pool pool_COMPANY }
"/*" { pool pool_COMPANY }
}
Any thoughts on what I'm getting wrong?
1 Reply
- hoolio
Cirrostratus
Hey Keith,
Can you add logging to the rule? Does the matching work for a single HTTP request on a TCP connection? Also, make sure to set all the switch case URI's to lower case as you're setting the URI to lower case (like /company).when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri] ] { "/app1*" { log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::uri] matched /app1" HTTP::redirect "https://www.company.com/PRODapp1" } "/app2*" { log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::uri] matched /app2" HTTP::redirect "https://www.company.com/COMPANY/" } "/app3*" { log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::uri] matched /app3" pool pool_app3 } "/company*" { log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::uri] matched /company" pool pool_COMPANY } default { log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::uri] matched default" pool pool_COMPANY } } }
Aaron
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
