Forum Discussion
Host_Header IRule for F5 LTM
I am trying to create an IRule to read an incoming host_header and based on the host_header, forward this request to another VirtualServer. I have seen examples to forward to server pools, but not to a different virtual server vip. Any help will be appreciated!!
7 Replies
- Arie
Altostratus
Are you looking for an HTTP redirect or masking it (i.e. connect to another destination without changing the URL)?
- Bob_May_78337
Nimbostratus
Say I have the below vip setup in the LTM: VS: 10.186.41.15 for host www.test.com and is the only vip accessible to the user population. I then create another LTM VS vip: 10.186.41.16 for www.dummy.com, which is "not" accessible to the user population.
I setup my dns to have both websites, "www.test.com & www.dummy.com" to point to 10.186.41.15 for resolution.
I want to create an IRule and assign it to the vip 10.186.41.15, that says any incoming request which has "www.dummy.com" in the host_header, forward this request to the vip 10.186.41.16.
- Arie
Altostratus
The best way to accomplish what you're looking for is to point both DNS-records to the same VIP, create separate pools for each of the domains, and use an iRule to select the pool based on the host.
- Bob_May_78337
Nimbostratus
So the only way to do this is to point to the pools, and not the vip's.
- Arie
Altostratus
Theoretically it's possible, but it would be a poor approach. The proper way is to use pools.
- Kevin_Stewart
Employee
It's totally possible.
when HTTP_REQUEST { if { [string tolower [HTTP::host]] equals "www.dummy.com" } { virtual dummy_vs } }where "dummy_vs" might be the name of the dummy virtual server. Best part, because you're using the virtual command, the dummy VIP's destination address doesn't have to be routable.
- Bob_May_78337
Nimbostratus
Thanks to everyone for your help with this issue!!
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