Forum Discussion
Lou_125071
Nimbostratus
Dec 09, 2014Load balance to specific pool by reading the X-Forwarded-For IP address
I've been asked if we can send specific client to a different pool based on the X-Forwarded-For IP address. I suspect this must be done via an IRule. Any help would be appreciated.
Thanks
nitass_89166
Noctilucent
Dec 09, 2014you can retrieve x-forwarded-for header value by using HTTP::header command and then you can do whatever you want e.g. send to specific node (node command) or pool (pool command), etc.
HTTP::header
">https://devcentral.f5.com/wiki/iRules.HTTP__header.ashx" target="_blank">">https://devcentral.f5.com/wiki/iRules.HTTP__header.ashx
Lou_125071
Nimbostratus
Dec 10, 2014Shaggy,
This is what we have so far and all works except if you do not have an X-Forwarded-For address and you are not in the Data group list you do not fall into the default pool. If you are in the list it works for both real client and X-Forwarded-For. Can you see anything here that would make it react this way?
when HTTP_REQUEST {
if {( [ class match [IP::client_addr] equals MY-List] )} {
pool MY-pool
} elseif {( [class match [_HTTP::header "X-Forwarded-For"] equals MY-List] )}{
pool TEST-pool
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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