Forum Discussion
Awkrd1_7470
Feb 23, 2012Nimbostratus
Unable to identify HTTP header variable for pool redirection
I have a two tier load balancing scenario where my client is accessing a load balanced SOA environment which I'll call my "upper load balance tier". The upper load balance tier accesses a VIP on the "lower load balance tier" where we load balance between two shopping sites. I need to provide a method for the client to return to the same data center. Since this is web content I don't have an application to insert a session id, or any other unique identifier so I can provide "persistence".The application team decided to insert a header "datacenter" with a variable "01" or "02" for datacenter identification and "persistence". I've verified the header "datacenter" exist in the subsequent request from the client but I can't get the i-Rule to identify the header, responds with an error. Please look at the rule and see what I have overlooked. Thanks!
when HTTP_RESPONSE{
if { [HTTP::header "datacenter"] equals "01" } {
log local0. "datacenter is $HTTP::header value"
pool DATACENTER-01
} elseif { [HTTP::header "datacenter"] equals "02" } {
log local0. "datacenter is $HTTP::header value"
pool DATACENTER-02
} else {
pool DATACENTER01-02
}
}
Error response: Feb 23 13:19:33 tmm tmm[1867]: 01220001:3: TCL error: PROD-ITA-9045-SELECT-POOL-ON-HTTP-HOST-HEADER-VALUE-20 - can't read "HTTP::header": no such variable while executing "log local0. "datacenter is $HTTP::header"" Thanks!
- hooleylistCirrostratusTry replacing $HTTP::header value with [HTTP::header "datacenter"].
- Awkrd1_7470NimbostratusCorrect...It should have been on the HTTP_REQUEST. I need to load balance the initial client request, which would not have the HTTP header "datacenter" present. The server inserts the HTTP header "datacenter" 01 or 02 in the response for the client's subsequent request to be used by the i-Rule and returned to the same data center. I modified the rule to add logging;
- nitassEmployeecan you try something like this?
when HTTP_RESPONSE { if { [HTTP::header exists "datacenter"] } { persist add uie [HTTP::header "datacenter"] } } when HTTP_REQUEST { if { [HTTP::header exists "datacenter"] } { persist uie [HTTP::header "datacenter"] } }
- Awkrd1_7470NimbostratusRan some test this morning and used the following rule which is actually working. Thanks!
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