Forum Discussion

unRuleY_95363's avatar
unRuleY_95363
Historic F5 Account
Nov 22, 2005

Old BEA WebLogic JSESSIONID persistence

Anybody with an older BEA WebLogic server willing to test the following rule to see if it works. The older WL servers encoded the server in the cookie and this rule supports digging that out so you can use the clustering of weblogic. I don't have access to an older BEA WebLogic server. This rule implements the wlnode() function as found in version 4.x of the bigip.

rule wlnode_4x_rule {
   when HTTP_REQUEST {
       Determine if this is http or https
      if { [catch {PROFILE::clientssl mode}] == 0 } {
         set https 1
      } else {
         set https 0
      }
       Break up the JSESSION ID into corresponding components
      if { [HTTP::cookie exists JSESSIONID] } {
         lset wl [split [HTTP::cookie JSESSIONID] !]
         set wl_primary 0
         set wl_node [ntohl [lindex $wl 2]]
         if { not $https } {
            set wl_port [ntohs [lindex $wl 3]]
         } else {
            set wl_port [ntohs [lindex $wl 4]]
         }
         set ip1 [expr {($wl_node >> 24) & 0xff}]
         set ip2 [expr {($wl_node >> 16) & 0xff}]
         set ip3 [expr {($wl_node >> 😎 & 0xff}]
         set ip4 [expr {$wl_node & 0xff}]
          Try the primary node
         pool wl_servers member "$ip1.$ip2.$ip3.$ip4" $wl_port
      } else {
         pool wl_servers
      }
   }
   when LB_FAILED {
       if there is a secondary JVMID
      if { [info exists $wl] and ([llength $wl] > 4) and $wl_primary } {
         set wl_primary 0
         set wl_node [ntohl [lindex $wl 6]]
         if { not $https } {
            set wl_port [ntohs [lindex $wl 7]]
         } else {
            set wl_port [ntohs [lindex $wl 8]]
         }
         set ip1 [expr {($wl_node >> 24) & 0xff}]
         set ip2 [expr {($wl_node >> 16) & 0xff}]
         set ip3 [expr {($wl_node >> 😎 & 0xff}]
         set ip4 [expr {$wl_node & 0xff}]
          Check the secondary node
         LB::reselect pool wl_servers member "$ip1.$ip2.$ip3.$ip4" $wl_port
      }
   }
}