Forum Discussion
Does LTM support websocket protocol with cookie persistence?
Hi All,
We're currently using BIG-IP 11.3.0 Build 3164.27. Currently, we trying to enable WebSocket technology on this F5 device. We set up the iRule below to make it work on all browsers.
CASE 1:
when CLIENT_ACCEPTED {
HTTP::enable
}
when HTTP_REQUEST {
if { ([string tolower [HTTP::header value Upgrade]] equals "websocket" ) && ([string tolower [HTTP::header value Connection]] contains "upgrade" ) } {
log local0. "HTTP Disable"
LB::select
HTTP::disable
}
}
The main problem that we're facing is with JSESSION ID mapping. When we take a look at the Request and Response headers that JSESSION ID mapping is different as shown below as a result the communication is broken [See Cookie and Set-Cookie fields in Request and Response headers].
*Request Header:*
Accept-Encoding:gzip, deflate, sdch, br
Accept-Language:en-US,en;q=0.8
Cache-Control:no-cache
Connection:Upgrade
Cookie:togglePanel=0; JSESSIONID=67D1ED8704774B7B254A3249D6AE1F5D.XXXX01;`
*Response Header:*
Connection:upgrade
Date:Fri, 09 Dec 2016 06:04:31 GMT
Sec-WebSocket-Accept:D1YD5WuwCtcc4kL5MeYZ5kT/cHc=
Sec-WebSocket-Extensions:permessage-deflate;client_max_window_bits=15
Server:Apache-Coyote/1.1
Set-Cookie:JSESSIONID=F9C8FFD641B1E42E99F632BF3D2D6BCD.XXXX02; Path=/Portal/
Set-Cookie:remember_me=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT
Upgrade:websocket
We tried using this iRule shown below to fix the mismatch in JSESSION ID, but in vain.
CASE 2
when CLIENT_ACCEPTED {
HTTP::enable
}
when HTTP_REQUEST {
if { ([string tolower [HTTP::header value Upgrade ]] equals "websocket" ) && ([string tolower [HTTP::header value Connection]] contains "upgrade" ) } {
if {[HTTP::is_keepalive]} {
HTTP::header replace "Connection" "Upgrade"
}
HTTP::disable
}
}
when HTTP_RESPONSE {
if { [string map {\" ""} [HTTP::cookie "JSESSIONID"]] ne "" } {
persist add uie [HTTP::cookie "JSESSIONID"]
}
}
}
Is there a workaround in iRule to fix this? Any help would be appreciated.
Thanks
Hi!
Could you please try to clean up the tcl rules by posting with the "Preformatted code" option? That would make it more likely that people will help. :)
/Patrik
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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