F5 - IRule Websocket pool select

 

IRule for selecting a Websocket pool

 

This iRule selects a specific pool or port based on whether the http connection is upgraded to a websocket connection.



# ------------------------------------------------------------------------------
# Name:		Websocket pool selector
# Author:	Eelke Smit <mail (AT) opensecure (DOT) nl>
# ------------------------------------------------------------------------------
# Revision history:
# 	18 Sept 2020	v1.0	First version
# ------------------------------------------------------------------------------
# Description:
# This iRule selects a specific pool or port based on whether the http connection
# is upgraded to a websocket connection.
# ------------------------------------------------------------------------------
# Requirements:
# websocket Profile
# http Profile
# ------------------------------------------------------------------------------

when HTTP_REQUEST {
  if { [string tolower [HTTP::header Upgrade]] contains "websocket" } {
      pool xxx-poolname
      HTTP::disable
  }
}