Forum Discussion
Jim_Bo
Nimbostratus
Apr 15, 2014HTTP::cookie, SWITCH and multiple identical pools
Hello Everyone, I must load balance a suite of applications across four nearly identical pools using a single virtual server; pool_a thru pool_d. The application team wants to distinguish between...
nitass
Employee
Apr 18, 2014add them back in during HTTP responses based upon the pool which processed the request.
request uri is not in http response. to make it clearer, have you ever used http analyzer tool such as httpfox? it can show you how http request and response look like.
httpfox
https://addons.mozilla.org/en-US/firefox/addon/httpfox/about the irule, can't we just move persist cookie command inside switch case? e.g.
config
[root@ve11a:Active:In Sync] config tmsh list ltm virtual bar
ltm virtual bar {
destination 172.28.24.10:80
ip-protocol tcp
mask 255.255.255.255
persist {
cookie {
default yes
}
}
profiles {
http { }
tcp { }
}
rules {
qux
}
source 0.0.0.0/0
source-address-translation {
type automap
}
vs-index 5
}
[root@ve11a:Active:In Sync] config tmsh list ltm rule qux
ltm rule qux {
when HTTP_REQUEST {
switch -glob [HTTP::path] {
"/pool_a/*" {
HTTP::path [string map {/pool_a/ /} [HTTP::path]]
persist cookie
pool pool_a
}
"/pool_b/*" {
HTTP::path [string map {/pool_b/ /} [HTTP::path]]
persist cookie
pool pool_b
}
default {
reject
}
}
}
}
test (sending request wrong cookie but the right pool is picked up - can see from response cookie)
[root@ve11a:Active:In Sync] config curl -I http://172.28.24.10/pool_a/ -H "Cookie: BIGipServerpool_b=1875429576.20480.0000"
HTTP/1.1 200 OK
Date: Fri, 18 Apr 2014 08:04:06 GMT
Server: Apache/2.2.3 (CentOS)
Last-Modified: Sun, 09 Feb 2014 08:39:51 GMT
ETag: "41879c-59-2a9c23c0"
Accept-Ranges: bytes
Content-Length: 89
Content-Type: text/html; charset=UTF-8
Set-Cookie: BIGipServerpool_a=1707657416.20480.0000; path=/
[root@ve11a:Active:In Sync] config curl -I http://172.28.24.10/pool_b/ -H "Cookie: BIGipServerpool_a=1707657416.20480.0000"
HTTP/1.1 200 OK
Date: Fri, 18 Apr 2014 08:05:22 GMT
Server: Apache/2.2.3 (CentOS)
Last-Modified: Tue, 23 Apr 2013 06:46:40 GMT
ETag: "418432-4b-8c2c3400"
Accept-Ranges: bytes
Content-Length: 75
Content-Type: text/html; charset=UTF-8
Set-Cookie: BIGipServerpool_b=1875429576.20480.0000; path=/
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