Forum Discussion
Craig_Serritell
Nimbostratus
Sep 10, 2010Pool member preference based on header
Has anybody had any experience with reading a http header and directing to a specific pool member based on some data in the header?
In the example below, I'm reading a http header called "No...
L4L7_53191
Nimbostratus
Sep 13, 2010Hi Craig, Matt here. Here's some sample code that logs what you want correctly. Note that I'm using HTTP_REQUEST, since I'm not sure that it matters if you've already got a pool member selected. It may matter, I just don't know.
when HTTP_REQUEST {
if { [HTTP::header exists "NodePre"] }{
set preference_array [split [string tolower [HTTP::header "NodePre"]] ":"]
set Pool_IP [lindex $preference_array 0]
set Pool_Port [lindex $preference_array 1]
log local0. "IP is: $Pool_IP"
log local0. "Port is: $Pool_Port"
log local0. "Sending to: $Pool_IP:$Pool_Port"
node $Pool_IP $Pool_Port
The entry below is just for my dummy tests.
HTTP::respond 200 content 'hello'
}
}
Please post back or contact me if you think this is off base.
-Matt
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