Forum Discussion
WillC_97839
Nimbostratus
Nov 18, 2009Different pool, but need to pass the query string along
Hi there.
I tried doing a search and I found some stuff that kinda helps, but I'm not quite getting the results that I want.
I have a site, www.widgets.com
When someone visits the site, and goes to a particular URL (www.widgets.com/widget-search/) I want to use a different pool and also pass the query string that they are search for. That part I got.
Here's the part I need help with:
1. The search url (/widget-search/) doesn't match 1-to-1 with the other pool. The other pool uses /search/virtualsearch?q=myquery
So, in plan english, if I do a search for "brown" directly off the page they have, it'll return something like:
http://widgets.search.com/search/widgetsearch?q=brown&category=big§ion= (etc etc)
I am able to pull the query and save that, but how do I send that to the pool, along with their particular search path (/search/virtualsearch?q=xxx) ?
2. I'd like to do is obfuscate it so when people search on www.widgets.com, it comes back like:
www.widgets.com/widget-search/?q=brown&category=big§ion= (etc etc)
Assuming that I'm able to pass the correct path and query to the other pool, will 2 automatically take place?
Thanks
4 Replies
- WillC_97839
Nimbostratus
As a side note, I know I can do a HTTP::redirect http://widgets.search.com/search/virtualsearch?myQUERY but then the URL come back as widgets.search.com, not widgets.com
Thanks - hoolio
Cirrostratus
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 - WillC_97839
Nimbostratus
I need the whole string preserved and passed along to the alt. pool. I just need the URL bar to look like the originating host (www.widgets.com, not search.widgets.com). All the links provided by the remote search engine will point back to my site, and not theirs.
Thanks - hoolio
Cirrostratus
So you can remove this section of the above example then: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...
The remaining parts should work as you've described. If you run into any issues, try adding logging to the iRule and check the /var/log/ltm output to help debug them.
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
