Forum Discussion
apache2020_5685
Nimbostratus
Aug 04, 2011Redirect to different pools depending on requested URI
Hi
I am looking for an irule to forward traffic to different pools dependant on the DNS name requested by the client, so effectively the client requests any of the below which all map to the same vips:
- cat1.com/test.asp
- cat2.com/test.asp
- cat3.com/test.asp
depending on which URI is called it should forward to:
- pool1
- pool2
- pool3
Thanks for your help
David
5 Replies
- boomchke_11156
Nimbostratus
Are you looking to redirect based on the /test.asp or on the actual DNS name catx.com? - boomchke_11156
Nimbostratus
See this thread, there are a couple examples of what you are lookig for.
http://devcentral.f5.com/Community/GroupDetails/tabid/1082223/asg/50/aft/1177235/showtab/groupforums/Default.aspx - apache2020_5685
Nimbostratus
Hi
I am looking to redirect based on dns name, all the example I can see are based on /test.asp etc - apache2020_5685
Nimbostratus
Hi
I think I have found thebest way to do it, I presume this is also pretty efficent and then drops out to the default vserver pool if there is no match?
when HTTP_REQUEST {
switch [HTTP::host] {
cat1.com {
pool pool1
}
cat2.com {
pool pool2
}
}
}
many thanks for your help, David - hoolio
Cirrostratus
I'd try this to explicitly define which pool to use in all cases:when CLIENT_ACCEPTED { Save the name of the VS default pool before it can be modified in HTTP_REQUEST set default_pool [LB::server pool] } when HTTP_REQUEST { switch [string tolower [HTTP::host]] { cat1.com { pool pool1 } cat2.com { pool pool2 } default { pool $default_pool } } }
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