Forum Discussion
hooleylist
Nov 18, 2009Cirrostratus
Do you want to preserve the entire query string or just one parameter? Do you need to rewrite the Host header value to widgets.search.com?
Here is an example which shows a few options. Note that you can "hide" the rewriting by not sending an HTTP redirect. The client won't see the change, assuming the web app does not use the rewritten URI in response headers or content it sends to the client.
when CLIENT_ACCEPTED {
Save the VIPs default pool name
set default_pool [LB::server pool]
}
when HTTP_REQUEST {
Check requested URI
switch -glob [HTTP::uri] {
"/widget-search/*" {
Request needs to go to second pool
pool widget_pool
Rewrite URI to /search/virtualsearch?q= with the original
value for the q parameter preserved
HTTP::uri "/search/virtualsearch?q=[URI::query [HTTP::uri] q]
Or...
Rewrite the URI to /search/virtualsearch with the original query string
HTTP::uri "/search/virtualsearch?[HTTP::query]
Rewrite the Host header to widgets.search.com
HTTP::header replace Host "widgets.search.com"
}
default {
Use the VIPs default pool
pool $default_pool
}
}
}
Aaron