CodeShare
Have some code. Share some code.
cancel
Showing results for 
Search instead for 
Did you mean: 
Mike_Dorado
F5 Employee
F5 Employee

Problem this snippet solves:

Sample Request:

https://x.x.x.x/abcdefgh-ijkl-mnop-qrst-0123456789#value=%22I%20am%20the%20one%22&name=%22Mike%22&p=%220f2fd14389da8d85fbd215c789f7f7d5%22


Requirement:

Extract Account ID from request URI such as ‘abcdefgh-ijkl-mnop-qrst-0123456789’

Then load balance traffic based on Account ID, and persist the same Account ID to the same backend pool member.


How to use this snippet:


Code :

when HTTP_REQUEST {
  set index1 [string first "/" [HTTP::uri] ] 
  set accountid [string range [HTTP::uri] [incr index1] end ]
  #log local0. "Account ID is: $accountid and will be persisted to same backend"
  persist hash $accountid
}
when LB_SELECTED {
  #log local0. "Backend is: [LB::server name]"
}
#Michelangelo Dorado | Nov 2021

Tested this on version:

No Version Found
Version history
Last update:
‎24-Nov-2021 22:41
Updated by:
Contributors