Forum Discussion
lunitic_56137
Nimbostratus
Sep 11, 2014Passing a header value to lb to pool
I am trying to load balance traffic according to a server response header value. I think I may be going way too deep into the woods here. Can you help a young Padawan with a direction please?
...
lunitic_56137
Nimbostratus
Sep 11, 2014Sorry, forgot to format the code section
Code
when RULE_INIT {
set newpool "";
}
when HTTP_RESPONSE {
if { [HTTP::header exists "X-Load-Balancer-Pool"] } {
set newpool [HTTP::header value "X-Load-Balancer-Pool" ]
log local0. "Header found to be $newpool"
HTTP::cookie insert name "Load-Balancer-Pool-cookie" value "$newpool"
} else {
log local0. "Header not found $newpool"
return
}
}
when HTTP_REQUEST {
if { [HTTP::cookie exists "Load-Balancer-Pool-cookie"] } {
set cookie_pool [HTTP::cookie value "Load-Balancer-Pool-cookie" ]
log local0. "Header found to be $cookie_pool"
pool $cookie_pool
} else {
log local0. "pool not found"
return
}
}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