Forum Discussion
Selecting a different node depending on URI
We are in the process of migrating services from an old Alteon load balancer to our F5 LTM 3900 (running 10.2.1). Most of the migrations have been successfully transferred as they were quite straightforward. One of the next ones is more complex however. There is a VIP on the Alteon with a single IP address and the end node (each with a different IP) is selected depending on the URI being requested, e.g. -
VIP = 1.2.3.4 Node 1 = 10.0.0.1 Node 2 = 10.0.0.2 etc. www.example1.com is sent to node 1 www.example2.com is sent to node 2 etc. What is the best way to achieve this on the F5 device? Thanks
6 Replies
- amolari
Cirrostratus
you could use this irule (if node port is 80)
when HTTP_REQUEST { switch -glob [HTTP::host] { www.example1.com { node 10.0.0.1 80 } www.example2.com { node 10.0.0.2 80 } } } - Peter_Mainwarin
Nimbostratus
That looks pretty straightforward, thanks amolari.
You can do this with an iRule that selects a pool or pool member based on the HTTP host header. Something like this:
when HTTP_REQUEST { switch [HTTP::host] { "www.example1.com" { pool example-pool member 10.0.0.1 } "www.example2.com" { pool example-pool member 10.0.0.2 } default { pool example-pool} } }You can also do it with an If/elseif instead of a switch if you only have a couple of options.
- Peter_Mainwarin
Nimbostratus
There are over 50 possible different matches for this VIP so setting up a pool looks like a great idea. Thanks for your answer.
- Robert_Luechte1
Nimbostratus
You can do this with an iRule that selects a pool or pool member based on the HTTP host header. Something like this:
when HTTP_REQUEST { switch [HTTP::host] { "www.example1.com" { pool example-pool member 10.0.0.1 } "www.example2.com" { pool example-pool member 10.0.0.2 } default { pool example-pool} } }You can also do it with an If/elseif instead of a switch if you only have a couple of options.
- Peter_Mainwarin
Nimbostratus
There are over 50 possible different matches for this VIP so setting up a pool looks like a great idea. Thanks for your answer.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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
