# App switching and cookie persistency

**URL:** <https://community.a10networks.com/t/app-switching-and-cookie-persistency/116>\
**Category:** aFleX\
**Created:** [August 12, 2011, 1:49am UTC](https://community.a10networks.com/t/app-switching-and-cookie-persistency/116 "2011-08-12T01:49:32Z")\
**Posts on this page:** 2\
**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:** [August 12, 2011, 1:49am UTC](https://community.a10networks.com/t/app-switching-and-cookie-persistency/116/1 "2011-08-12T01:49:32Z")

</div>

**Posted by jmaddox** question from a customer. Aflex is likely not needed here: The domain is [www.domain.com](http://www.domain.com)[http://www.domain.com](http://www.domain.com) with a URI of [www.domain.com/sf](http://www.domain.com/sf)[http://www.domain/sf](http://www.domain/sf), [www.in-drive.com/sf-register](http://www.in-drive.com/sf-register)[http://w...com/sf-register](http://w...com/sf-register), etc… I have 2 Service Groups: Service Group 1: Windows Server 1 Windows Server 2 Service Group 2: RedHat Server 1 RedHat Server 2 Now, per documentation I know that Persistency rules are processed before Aflex. Per the VIP/port I can assign one Cookie Template. So my problem is if a user goes to [www.in-drive.com/](http://www.in-drive.com/)[http://www.in-drive.com/](http://www.in-drive.com/) the cookie persistency is assigned to a Windows Server in Service Group 1. If the user then goes to [www.in-drive.com/sf](http://www.in-drive.com/sf)[http://www.domain.com/sf](http://www.domain.com/sf) the cookie persistency will point them to a windows server instead of one of the RedHat Servers in Service Group 2. Vice versa if they went to [www.domain.com/sf](http://www.domain.com/sf)[http://www.domain.com/sf](http://www.domain.com/sf) first. Right now, as long as the user goes to [www.in-drive.com/sf\*](http://www.in-drive.com/sf*)[http://www.in-drive.com/sf\*](http://www.in-drive.com/sf*) and stays within this base URI, there is no problem same as [www.in-drive.com/\*](http://www.in-drive.com/*)[http://www.domain.com/\*](http://www.domain.com/*) So is it possible to assign Cookie Persistency with name “indrive” if they go to pool or Service Group 1 and assign Cookie Persistency with name “indrivesf” if they go to pool or Service Group 2? Ultimately, I would have to use AFLEX to match URI and Cookie to send them back to the servers they are looking for Please note: My ideal solution is when [www.in-drive.com/sf](http://www.in-drive.com/sf)[http://www.domain.com/sf](http://www.domain.com/sf) comes into the LB, I would like to forward this to sf.in-drive.com\<[domain.com\>](http://domain.com%3E) (does not exist) that would allow me to create a new VIP/port groups and persistency here would not be a problem. However, due to “cosmetic” issues, the business unit wants to see if the above solution is at all feasible.

---

<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:** [August 12, 2011, 1:50am UTC](https://community.a10networks.com/t/app-switching-and-cookie-persistency/116/2 "2011-08-12T01:50:27Z")

</div>

**Posted by ddesmidt** aFleX gives you a lot of flexibility and power. But actually you don’t need an aFleX here. Our built-in Cookie Template can reply to your need: . Go to Service Group “SG2” if the request in “/sf” and keep persistence there . Go to Service Group “SG1” if the request in “anything else” and keep persistence there For that use the Cookie persistence template:

| **Code:** |
| --- |
|   
  
—  
  
`slb template http test_http url-switching starts-with /sg service-group SG2 ! slb template persist cookie test_cookie match-type service-group ! slb virtual-server googletest 1.1.1.1 port 80 http service-group SG1 template persist cookie test_cookie template http test_http !`  
  
—  
  
 |

Dimitri
