Forum Discussion
nitass
Nov 23, 2011Employee
Aaron,
noted with thanks. by the way, i think you might forget to change HTTP::header to HTTP::cookie in HTTP_RESPONSE event.
this is my testing.
[root@ve1023:Active] config b virtual bar list
virtual bar {
snat automap
pool foo
destination 172.28.19.79:80
ip protocol 6
rules myrule
profiles {
http {}
tcp {}
}
}
[root@ve1023:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST {
set SessionId [HTTP::cookie ASP.NET_SessionId]
log local0. "[IP::client_addr]:[TCP::client_port]: Request SessionId is: $SessionId"
if { $SessionId != "" } { persist uie $SessionId 3600 }
}
when LB_SELECTED {
log local0. "[IP::client_addr]:[TCP::client_port]: Selected [LB::server]"
}
when LB_FAILED {
log local0. "[IP::client_addr]:[TCP::client_port]: Failed [LB::server]"
}
when SERVER_CONNECTED {
log local0. "[IP::client_addr]:[TCP::client_port]: Connected [IP::server_addr]:[TCP::server_port]"
}
when HTTP_RESPONSE {
set SessionId [findstr [HTTP::header Set-Cookie] "ASP.NET_SessionId" 18 24]
set SessionId [HTTP::cookie "ASP.NET_SessionId"]
log local0. "[IP::client_addr]:[TCP::client_port]: Response SessionId is: $SessionId from Set-Cookies: [HTTP::header values Set-Cookie]"
if { $SessionId != "" }{
persist add uie $SessionId 3600
log local0. "[IP::client_addr]:[TCP::client_port]: Persist record [persist lookup uie $SessionId]"
}
}
}
[root@ve1023:Active] config curl -I http://172.28.19.79
HTTP/1.1 200 OK
Date: Wed, 23 Nov 2011 22:04:39 GMT
Server: Apache/2.2.3 (CentOS)
Last-Modified: Fri, 11 Nov 2011 14:48:14 GMT
ETag: "4183e4-3e-9c564780"
Accept-Ranges: bytes
Content-Length: 62
Set-Cookie: ASP.NET_SessionId=edfozx45o40stpfgnbtue045; path=/; HttpOnly
Set-Cookie: EPowerV4Users=carrefourvoyagesb2b=13_user; path=/
Set-Cookie: EPowerV4UsersCorporates=carrefourvoyagesb2b=agencyantibes; path=/
Set-Cookie: VisitorID=1703234c-e2be-45a4-a9c3-29183aa09fde; expires=Fri, 23-Nov-2012 07:55:38 GMT; path=/
Connection: close
Content-Type: text/html; charset=UTF-8
[root@ve1023:Active] config
Nov 23 14:04:25 local/tmm info tmm[23027]: Rule myrule : 172.28.19.80:56914: Request SessionId is:
Nov 23 14:04:25 local/tmm info tmm[23027]: Rule myrule : 172.28.19.80:56914: Selected foo 200.200.200.101 80
Nov 23 14:04:25 local/tmm info tmm[23027]: Rule myrule : 172.28.19.80:56914: Connected 200.200.200.101:80
Nov 23 14:04:25 local/tmm info tmm[23027]: Rule myrule : 172.28.19.80:56914: Response SessionId is: edfozx45o40stpfgnbtue045 from Set-Cookies: {ASP.NET_SessionId=edfozx45o40stpfgnbtue045; path=/; HttpOnly} {EPowerV4Users=carrefourvoyagesb2b=13_user; path=/} {EPowerV4UsersCorporates=carrefourvoyagesb2b=agencyantibes; path=/} {VisitorID=1703234c-e2be-45a4-a9c3-29183aa09fde; expires=Fri, 23-Nov-2012 07:55:38 GMT; path=/}
Nov 23 14:04:25 local/tmm info tmm[23027]: Rule myrule : 172.28.19.80:56914: Persist record foo 200.200.200.101 80