DataScript: avi.pool.chash

DataScript

Function avi.pool.chash ( string )
Description Sets the string value that the consistent hash load-balancing algorithm hashes on to choose a server within the selected pool
Events HTTP_REQ
Parameter The string value must be specified, and can be created in any manner.
Returns No return value
Example If there is a header by the name "custom-hash" in a request, then use its value as input to the Consistent Hash with Custom Data load-balancing algorithm to select a server out of the pool named "pool-of-servers." The pool should be configured to have its load-balancing algorithm set to Consistent Hash on Custom Data.

hash = avi.http.get_header("custom-hash")
if hash then
   avi.pool.select("pool-of-servers")
   avi.pool.chash(hash)
end