# Persistence based on Header value

**URL:** <https://community.f5.com/t/persistence-based-on-header-value/34775>\
**Category:** Technical Forums\
**Tags:** irules, devops, application-delivery\
**Created:** [December 17, 2013, 9:53am UTC](https://community.f5.com/t/persistence-based-on-header-value/34775 "2013-12-17T09:53:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jo\_31162](https://avatars.discourse-cdn.com/v4/letter/j/f4b2a3/32.png) [@Jo\_31162](https://community.f5.com/u/Jo_31162)\
**Post date:** [December 17, 2013, 9:53am UTC](https://community.f5.com/t/persistence-based-on-header-value/34775/1 "2013-12-17T09:53:38Z")

</div>

Hi all, I need to configure an iRule in order to make persistence based on hexadecimal value in HTTP header. This field is variable and can be 8 number/characters long. I was thinking of using Universal profile persistence but I’m not an expert of TCL language. Could someone help me? Thanks in advance for any help.

---

<div class="post-metadata">

**Author:** ![nathe](https://avatars.discourse-cdn.com/v4/letter/n/eb8c5e/32.png) [@nathe](https://community.f5.com/u/nathe)\
**Post date:** [December 17, 2013, 10:59am UTC](https://community.f5.com/t/persistence-based-on-header-value/34775/2 "2013-12-17T10:59:37Z")

</div>

GiJo,

If it’s simply a case of the HTTP Header value is what you want to persist on, and not a substring of this value, then something like this should help:

```tcl
when HTTP_REQUEST {
  if { [HTTP::header exists "Name"] } {
    persist uie [HTTP::header "Name"]
  }
 }

```

Hope this helps,

N

---

<div class="post-metadata">

**Author:** ![Jo\_31162](https://avatars.discourse-cdn.com/v4/letter/j/f4b2a3/32.png) [@Jo\_31162](https://community.f5.com/u/Jo_31162)\
**Post date:** [December 17, 2013, 11:20am UTC](https://community.f5.com/t/persistence-based-on-header-value/34775/3 "2013-12-17T11:20:02Z")

</div>

Many thanks again Nathan. So,with GET command receive something like this: GET /bin HTTP/1.1 Host: x.x.x.x Accept: _/_ z-y:012AB123

My interest field is after z-y: How LTM can read this variable hexadecimal value? Rgds

---

<div class="post-metadata">

**Author:** ![nathe](https://avatars.discourse-cdn.com/v4/letter/n/eb8c5e/32.png) [@nathe](https://community.f5.com/u/nathe)\
**Post date:** [December 17, 2013, 11:39am UTC](https://community.f5.com/t/persistence-based-on-header-value/34775/4 "2013-12-17T11:39:54Z")

</div>

Try this then:

```tcl
when HTTP_REQUEST {
 if { [HTTP::header exists "Accept"] } {
 persist uie [findstr [HTTP::header Accept] /z-y: 5 end ] 
 }
}

```

Hope this helps,

N

---

<div class="post-metadata">

**Author:** ![Jo\_31162](https://avatars.discourse-cdn.com/v4/letter/j/f4b2a3/32.png) [@Jo\_31162](https://community.f5.com/u/Jo_31162)\
**Post date:** [January 10, 2014, 7:51am UTC](https://community.f5.com/t/persistence-based-on-header-value/34775/5 "2014-01-10T07:51:18Z")

</div>

Hi all again, sorry for my later but customer has stopped all test for Christmas holidays. Regarding my last analisys,I saw that client produce this http requests at first access:

Dec 20 16:14:35 slot1/office-01 info tmm[20803]: Rule /Common/\_log : BL **01DE57DB** -01-0100002A-09CD-6C657E1E3A66B251BB0721F84F5B63D9-AA2D6AC5-0000000000000000

Dec 20 16:14:35 slot1/office-01 info tmm[20803]: Rule /Common/\_log : BC **01DE57DB** -01-0100002A-09CD-5B93234019D664D8E5B5EDDA2EC3A0EA-AA2D6AC5-0000000000000000

Dec 20 16:14:35 slot1/office-01 info tmm1[20803]: Rule /Common/\_log : default 01- **01DE57DB** -0100002A-00000001-02-9839481D834EAD2B-01-FF9483C5

Dec 20 16:14:36 slot1/office-01 info tmm[20803]: Rule /Common/\_log : default 01- **01DE57DB** -0100002A-00000002-02-88DF28915BCEF2D7-01-64793012

That are two GET and two POST

Subsequently, traffic from the same previous client are two POST:

Dec 20 16:15:12 slot1/office-01 info tmm1[20803]: Rule /Common/\_log : default 01- **01DE57DB** -0100002A-00000003-02-ACD18B62E259B7C0-01-D8E547FD

Dec 20 16:15:13 slot1/office-01 info tmm[20803]: Rule /Common/\_log : default 01- **01DE57DB** -0100002A-00000004-02-DC1E968BBC75898F-01-AFAF3DF6

So, I need to persist session on **01DE57DB** value that is a VARIABLE numeric value that BIGIP decode into hexadecimal value.

Is it possible to do? BRgds

---

<div class="post-metadata">

**Author:** ![abvaidya\_182376](https://avatars.discourse-cdn.com/v4/letter/a/fbc32d/32.png) [@abvaidya\_182376](https://community.f5.com/u/abvaidya_182376)\
**Post date:** [January 12, 2015, 4:40pm UTC](https://community.f5.com/t/persistence-based-on-header-value/34775/6 "2015-01-12T16:40:44Z")

</div>

Looking for answer to a similar question posted at below link. Please respond in case you know about it [DevCentral - An F5 Technical Community](https://devcentral.f5.com/s/feed/0D51T00006i7ZqISAU)
