Persist using a string in an HTTP URI
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 FoundPublished Nov 25, 2021
Version 1.0michelangelodorado
Employee
Joined December 02, 2019
michelangelodorado
Employee
Joined December 02, 2019
No CommentsBe the first to comment