Forum Discussion
Patrez_70317
Nimbostratus
Sep 16, 2016Hash persistence based on substring in URI
Hello,
I am looking for a way how to implement persistence based on UID that is in URI.
Here is the example URI: /v1/projects/f12876fe-1b1c-4e5b-80d1-7e40929d72d3/iou/vms
The bold part will be d...
Kai_Wilke
MVP
Sep 16, 2016Hi Patrez,
you may try the snippet below...
when HTTP_REQUEST {
if { ( [HTTP::path] starts_with "/v1/projects/" ) and ( [set uie [getfield [HTTP::path] "/" 4]] ne "" ) } then {
persist carp $uie
} else {
persist none
}
}
Note: The provided script uses the stateless CARP algorythm to distribute and track persistence. You may change it to
if you want to have a stateful persistence tracking.persist hash $uie [lifetime in seconds]
Note: Also keep in mind to attch a OneConnect Profile to your Virtual Server if a single users is accessing multiple projects using the same browser session. This will allow your LTM to rebalance each request to the right pool member.
Cheers, Kai
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects