15-Sep-2023 15:15
Team,
I have a virtual server with port 8899 configured as PerformanceLayer4 and FastL4. I am using couple Host names to drive thru this Virtual Server.
I want to send the traffic to pool_magnus when the traffic is coming with host magnus.com.
I wrote an Irule as below but its not working I can see the host coming and still going to the default pool. I think the traffic coming is not http traffic its TCP traffic. Need assistance. 🙂
when HTTP_REQUEST {
set host [string tolower [HTTP::host]]
if { $host eq "magnus.com" } {
pool pool_magnus
}
}
15-Sep-2023 18:34
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
16-Sep-2023 00:27
Dear Mohamed ,
can you please clarify the setting for this LTM Policy if we do not need to use the Irule?
17-Sep-2023 20:53 - edited 17-Sep-2023 20:55
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
18-Sep-2023 00:59
18-Sep-2023 02:10
If it helps, you can do this very quickly in a Policy (LTP)
When HTTP Host = <Hostname> on Request.
Forward to "Virtual Server or Pool"
Its a very simiular concept to vip targetting vip, but its vip targetting many pools.
I do something very simular with uri's and pools.