Forum Discussion
Narendra_26827
Jul 07, 2011Nimbostratus
iRule to read key/value pair from Data Group lists
We
have a requirement with our product that load balancer should be able to send
requests to a particular pool ip based on a configuration file that we should
have in the load balancer. Example: ...
Colin_Walker_12
Jul 07, 2011Historic F5 Account
So all you're looking for is to look up a custom header value in a Data Group and have that map to a pool member address. That's very doable. You'd want something like:
when HTTP_REQUEST {
if {[HTTP::header exists "myCustomHeader"]} {
set member [class match -value [HTTP::header "myCustomHeader"] equals myClassName]
if {$member ne ""} {
pool member $member 80
}
}
}
This would require a data group named myClassName that looks like you described above, sample1 with a value of 192.168.1.11, sample2 with a value of 192.168.1.12, etc. and it assumes the custom header is named "myCustomHeader" with the values of sample1, sample2, etc.
You can, of course, change any of the variable or data group names to be more to your liking.
Colin
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