Forum Discussion
Jim_Carlberg_98
Nimbostratus
Mar 17, 2009Parsing Traffic by URI
I have have a URI that is www.governor/sir/vote and www.governor/vote. I need to send www.governor/vote to l7-ete-amsi pool. For www.governor/sir/vote, I need to strip out /sir/ and have the URI go to L7-ETE-AMSI-REDIRECT.
when HTTP_REQUEST {
switch -glob [HTTP::uri] {"/sir/*" {HTTP::uri[string map {"/sir/" "/"}
[HTTP::uri]] pool L7-ETE-AMSI-REDIRECT}
default {pool l7-ETE-AMSI}}}
Thanks
- hoolio
Cirrostratus
Hi William,when HTTP_REQUEST { switch -glob [HTTP::path] { "/sir/*" { HTTP::uri [string map {"/sir/" "/"} [HTTP::uri]] pool L7-ETE-AMSI-REDIRECT } default { pool l7-ETE-AMSI } } }
- Jim_Carlberg_98
Nimbostratus
Thanks, this is a lot closer. The default pool works now. However, I'm not getting the /sir/ to be replaced with /. Any ideas? I've checked the case on the url and it's lower case. - hoolio
Cirrostratus
Do you see the URI being updated in the request made to the server? The value for HTTP::uri is cached in the same event (and same priority) so you wouldn't see it log statements in the HTTP_REQUEST event.when HTTP_REQUEST { log local0. "[IP::client_addr]:[TCP::client_port]: Original URI: [HTTP::uri]" switch -glob [HTTP::path] { "/sir/*" { HTTP::uri [string map {"/sir/" "/"} [HTTP::uri]] pool L7-ETE-AMSI-REDIRECT } default { pool l7-ETE-AMSI } } } when HTTP_REQUEST priority 501 { log local0. "[IP::client_addr]:[TCP::client_port]: Current URI: [HTTP::uri]" }
- Jim_Carlberg_98
Nimbostratus
The debug was a great idea. I added and * to the front of the sir. Now it reads *sir* and the i-rule works. Thanks for all the help.
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