Forum Discussion
Moe_Jartin
Cirrus
Jan 05, 2009Context Root Masking/URL Rewrite and pool selection
I have an existing iRule that simply selects poolA based on a list of URIs, everything else goes to poolB.
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
...
hoolio
Cirrostratus
Jan 05, 2009You should only need to change the path in the request. You can do this with HTTP::path instead of a stream filter (which would modify the request payload):
Prepend /contextroot to the original path
HTTP::path "/contextroot[HTTP::path]"
For the response, are you sure non-200 responses won't ever contain the /contextroot? You should also explicitly disable the stream filter if the condition(s) aren't met:
when HTTP_RESPONSE {
if {[[HTTP::status] == 200] and [[HTTP::header value "Content-Type"] contains text]} {
STREAM::expression "@/contextroot@@"
STREAM::enable
} else {
Disable the stream filter
STREAM::disable
}
}
Also, you can use variables in a stream expression as long as you wrap the expression with double quotes (like you did) instead of curly braces.
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
