Forum Discussion
hooleylist
Mar 16, 2009Cirrostratus
Also, you can use IP::addr (Click here) to compare the XFF value to the IP address. This will be more efficient than a string comparison.
[IP::addr [HTTP::header "X-Forwarded-For"] equals 4.4.4.0]
And if you're selecting a pool for some HTTP requests, you should make a pool selection for all others in the iRule. This ensures that requests make it to the correct pool. If you don't want to hard code the pool name in the iRule you can use 'LB::server pool' to get it before the selected pool has been modified on the TCP connection:
when CLIENT_ACCEPTED {
Save VIP's default pool name
set default_pool [LB::server pool]
}
when HTTP_REQUEST {
if { [IP::addr [HTTP::header "X-Forwarded-For"] equals 4.4.4.0] } {
pool webcrawler.dummy.pool
} else {
pool $default_pool
}
}
}
Aaron