Forum Discussion
Cookie persistence 4.x to 10.x config conversion
I have a 4.x config with the following:
- pool A with cookie persistence
- pool A inserts cookie XPTO_A
pool poolA {
lb_method observed_member
persist cookie
cookie_mode insert
cookie_name XPTO_A
cookie_expiration 0d 00:04:00
member 1.1.1.10:80
}
- pool B with no persistence configured
pool poolB {
member 1.1.1.20:80
}
- rule calling pool A or poolB, depending on some "ifs":
if (http_host == "xptoA.com") {
use pool poolA
}
else if (http_host == "xptoB.com") {
use pool poolB
}
So, we have here a rule that depending on the "ifs", it does or does not do persistence via cookies.
Can you please help me and check to see if my below procedure is correct, in order to convert that config from 4.x to 10.x?
What I think it is the best conversion from 4.x config to 10.x:
1. configure the default persistence profile for the virtual server in question as cookie
2. configure the iRule to perform the persistence or not, based on the "ifs":
when HTTP_REQUEST {
set http_host_value [string tolower [HTTP::host]]
if {$http_host_value eq "xptoA.com"}
{
persist cookie insert "XPTO_A" "0d 00:04:00"
pool poolA
}
else if {$http_host_value eq "xptoB.com"}
{
persist none
pool poolB
}
}
Is it enough? Do you think it will work? It is the best way to do the conversion?
Thanks in advance.
JPL
- nitass
Employee
[root@ve1023:Active] config b virtual bar list virtual bar { snat automap destination 172.28.65.152:http ip protocol tcp rules myrule persist cookie profiles { http {} tcp {} } } [root@ve1023:Active] config b rule myrule list rule myrule { when HTTP_REQUEST { switch [string tolower [HTTP::host]] { "xptoa.com" { persist cookie insert "XPTO_A" "0d 00:04:00" pool poolA } "xptob.com" { persist none pool poolB } } } } [root@ve1023:Active] config b pool poolA list pool poolA { members 200.200.200.101:http {} } [root@ve1023:Active] config b pool poolB list pool poolB { members 74.125.235.48:http {} } [root@ve1023:Active] config curl -I http://xptoA.com/ HTTP/1.1 200 OK Date: Mon, 07 Nov 2011 18:44:10 GMT Server: Apache/2.2.3 (CentOS) Last-Modified: Mon, 07 Nov 2011 11:52:31 GMT ETag: "4183e3-2a-b08f5dc0" Accept-Ranges: bytes Content-Length: 42 Connection: close Content-Type: text/html; charset=UTF-8 Set-Cookie: XPTO_A=1707657416.20480.0000; expires=Mon, 07-Nov-2011 18:43:27 GMT; path=/ [root@ve1023:Active] config curl -I http://xptoB.com/ HTTP/1.1 302 Found Location: http://www.google.com/ Cache-Control: private Content-Type: text/html; charset=UTF-8 X-Content-Type-Options: nosniff Date: Mon, 07 Nov 2011 18:44:15 GMT Server: sffe Content-Length: 219 X-XSS-Protection: 1; mode=block
- JPL_55483
Nimbostratus
Thanks nitass, you provided me the confirmation I needed. - JPL_55483
Nimbostratus
Another way to do it could be creating a new persistence profile based on cookie persist and associate that new profile to the irule via persist command?Example:
profile persist my_cookie_persist_profile {
defaults from cookie
mode cookie
cookie mode insert
cookie name "
XPTO_A"cookie expiration 0:04:00
override connection limit disable
}
and then in the irule:
when HTTP_REQUEST {
set http_host_value [string tolower [HTTP::host]]
if {$http_host_value eq "xptoA.com"}
{
persist
my_cookie_persist_profilepool poolA
}
}
Recent Discussions
Related Content
* 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