Forum Discussion
iRule for sending traffic to a different pool based on the Hostname.
- Sep 18, 2023
you need to ensure that you have http profile binded to the VIP in order to have irule attached thats all you need.
If you are planning to use traffic policies then you can refer the below
Hi ashk ,
- you must add a HTTP profile in your bigip to let it able to parse http requests and understand the meaning of hostnames and headers.
you can use the following syntax but after adding http profile first :
when HTTP_REQUEST {
#Check requested host header (set to lowercase)
switch [string tolower [HTTP::host]] {
"www.site1.com" {
pool site1_pool
}
"www.site2.com" {
pool site2_pool
}
default {
pool default_pool
}
}
}
- you can use If statement as well.
- the most efficiecnt one is to use Local traffic policies , it's light weight on system CPU and it's very easy to implement.
I hope this helps you
- Amr_AliSep 16, 2023MVP
Dear Mohamed ,
can you please clarify the setting for this LTM Policy if we do not need to use the Irule?
- vaibhavSep 18, 2023Cirrostratus
you need to ensure that you have http profile binded to the VIP in order to have irule attached thats all you need.
If you are planning to use traffic policies then you can refer the below
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