Basic HTTP Switching aFlex
in aFleX
Posted by kberton
What follows is a basic aFlex that will switch HTTP requests based on three different criteria -- User-Agent, URI and Host -- to the desired Service Group.
when HTTP_REQUEST {
if { [HTTP::header "User-Agent"] contains "Auto Installer"} {
pool sg_Auto_Installer
}
if { [HTTP::uri] starts_with "/en" } {
pool sg_http_en
} elseif { [HTTP::uri] starts_with "/lp" } {
pool sg_http_lp
} elseif { [HTTP::host] contains "mycompany.co.uk"} {
pool sg_http_uk
}
}
What follows is a basic aFlex that will switch HTTP requests based on three different criteria -- User-Agent, URI and Host -- to the desired Service Group.
when HTTP_REQUEST {
if { [HTTP::header "User-Agent"] contains "Auto Installer"} {
pool sg_Auto_Installer
}
if { [HTTP::uri] starts_with "/en" } {
pool sg_http_en
} elseif { [HTTP::uri] starts_with "/lp" } {
pool sg_http_lp
} elseif { [HTTP::host] contains "mycompany.co.uk"} {
pool sg_http_uk
}
}
0
Comments
Slick, but when would I need to use this?
What is the Auto-Installer?
This came in handy for a customer that used a single vip/vport to conserve public IP addresses yet needed to switch to different pools based on the requested content. the "/en" rule sends users to the english language web site which is hosted on a separate pool of servers; "mycompany.co.uk" serves UK customers; etc, etc...
Auto Installer is the user agent header used by their automated "phone home" update application that gets installed on all of their customers systems. the application updates are hosted on another set of web servers in the back end and setting the aFlex to trigger on UA was a big win for this customer to be able to handle the surges associated with new product updates.