# Persistence aFlex based on UIE from real server

**URL:** <https://community.a10networks.com/t/persistence-aflex-based-on-uie-from-real-server/110>\
**Category:** aFleX\
**Created:** [July 28, 2011, 1:38am UTC](https://community.a10networks.com/t/persistence-aflex-based-on-uie-from-real-server/110 "2011-07-28T01:38:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/a10_community/original/1X/bb9f186d33804d3044a0374e589f49fdf3be1328.png) [@system](https://community.a10networks.com/u/system)\
**Post date:** [July 28, 2011, 1:38am UTC](https://community.a10networks.com/t/persistence-aflex-based-on-uie-from-real-server/110/1 "2011-07-28T01:38:49Z")

</div>

**Posted by aanchev**

This script was written for a home grown web application that sets a UIE when a client establishes a connection to the server. If a client has no UIE, it is load balanced normally. If the client has a UIE, the script provides stickiness to the server the client received it from.

when HTTP\_REQUEST { set query [HTTP::query] if { $query contains “rid=” } { log local0. “Query value: $query” set tempvalue [getfield [HTTP::query] “rid=” 2] log local0. “Temp value: $tempvalue” set value [substr $tempvalue 0 “&”] log local0. “Parsed rid: $value” set persistvalue [persist lookup uie $value all] if { $persistvalue ne “” } { persist uie $value } } }

when HTTP\_RESPONSE { persist add uie $value 3600 }
