Forum Discussion
nitass
Apr 18, 2014Employee
add 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=/