Forum Discussion
JosephT
Nimbostratus
Mar 13, 2009Back to basics - redirect to a virtual server
We're working on an irule to send connections to another virtual server based on a match on the X-forwarded header. The reason for this is so we can rate-limit the number of connections (by using Con...
hoolio
Cirrostratus
Mar 16, 2009Also, 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
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