# Using a default persistence profile and iRule persistence on the same VS

**URL:** <https://community.f5.com/t/using-a-default-persistence-profile-and-irule-persistence-on-the-same-vs/24414>\
**Category:** Technical Forums\
**Tags:** irules, dev, devops, application-delivery\
**Created:** [February 9, 2009, 3:10pm UTC](https://community.f5.com/t/using-a-default-persistence-profile-and-irule-persistence-on-the-same-vs/24414 "2009-02-09T15:10:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![naladar\_65658](https://avatars.discourse-cdn.com/v4/letter/n/b2d939/32.png) [@naladar\_65658](https://community.f5.com/u/naladar_65658)\
**Post date:** [February 9, 2009, 3:10pm UTC](https://community.f5.com/t/using-a-default-persistence-profile-and-irule-persistence-on-the-same-vs/24414/1 "2009-02-09T15:10:42Z")

</div>

I have an iRule applied to a VS that sends traffic to different pools based on its uri. I have a default persistence profile defined already on the VS (smsession) but on one of the pools I would like to use a different method of persistence (cookie).

If I define the persistence to that pool in my iRule as shown below, which method of persistence is used in the end? Can you use a default persistence profile AND specify a different method using an iRule?

```tcl
when HTTP_REQUEST { 
 set header_uri [string tolower [HTTP::uri]] 
 if { [matchclass $header_uri starts_with $::www_uri] } { 
 pool WWW_Pool 
 } elseif { [matchclass $header_uri starts_with $::oam_uri] } { 
 HTTP::redirect "https://oam.companyname.com/oam/main/oamMain.jsp" 
 } elseif { [matchclass $header_uri starts_with $::cp_uri] } { 
 persist cookie insert "CP_Cookie" "0d 03:00:00" 
 pool CP_Pool 
 } else { 
   pool My_Pool 
  } 
 }

```

---

<div class="post-metadata">

**Author:** ![JRahm](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/jrahm/32/3327_2.png) [@JRahm](https://community.f5.com/u/JRahm)\
**Post date:** [February 10, 2009, 10:20pm UTC](https://community.f5.com/t/using-a-default-persistence-profile-and-irule-persistence-on-the-same-vs/24414/2 "2009-02-10T22:20:40Z")

</div>

This should work fine, you can also disable persistence altogether when it’s set on the virtual with the **persist none** command.

---

<div class="post-metadata">

**Author:** ![marcomerlo](https://avatars.discourse-cdn.com/v4/letter/m/c2a13f/32.png) [@marcomerlo](https://community.f5.com/u/marcomerlo)\
**Post date:** [December 19, 2023, 11:48am UTC](https://community.f5.com/t/using-a-default-persistence-profile-and-irule-persistence-on-the-same-vs/24414/3 "2023-12-19T11:48:49Z")

</div>

Hi , I have a “mirror” issue. I have a vip with a default pool and a default persistence profile. I need to write an iRule that select another pool for some clients that are listed in a data group but I have to be sure that the default persistece profile is used for those clinets as well. Will I get the result just omitinng any persist command in the iRule? Unfortunately I need both mirroring and croos service persistence that are not configurable with the persistence command ..  
Regards

MM
