Forum Discussion
srantos_87030
Jul 25, 2012Nimbostratus
iRule to bypass default pool
Hello, if
{[HTTP::host] contains "facebook"} { pool
isa_pool snat
automap}}
I am using a virtual server to load-balance HTTP traffic from customers to a pool of traffic servers. I need an iRule to bypass this pool and send the HTTP requests to an Internet proxy with IP address 172.19.44.13 when the HTTP request contains the string "facebook" in the Host header.
I am using this iRule:
when
HTTP_REQUEST {
I am testing and I notice that as soon as this iRule matches when I visit "www.facebook.com" for example, it will match any other HTTP request after the first correct match. For example, if I visit "www.google.com" after I visit "www.facebook.com" the iRule will match for google as well!
Can you think what is wrong? Thank you in advance.
- natheCirrocumulussrantos,
when HTTP_REQUEST { if {[string tolower [HTTP::host]] contains "facebook"}{ log local0. "HTTP Host: [HTTP::host]" pool isa_pool snat automap } }
- hooleylistCirrostratusThis is the default connection based load balancing behavior. To have LTM load balance per HTTP request you can either add a OneConnect profile to the VS or specify a pool in every case when you're specifying a pool for any case. Here's an example of the latter:
when CLIENT_ACCEPTED { Save the name of the VS default pool before it is changed in this iRule set default_pool [LB::server pool] } when HTTP_REQUEST { if {[string tolower [HTTP::host]] contains "facebook"}{ log local0. "Using isa pool for HTTP Host: [HTTP::host]" pool isa_pool snat automap } else { log local0. "Using default pool $default_pool for HTTP Host: [HTTP::host]" pool $default_pool snat none } }
- hooleylistCirrostratusI meant to include a link to more info on this:
- srantos_87030NimbostratusThank you hoolio and nathan.
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects