Forum Discussion
Cookie Persistence in dual datacenter
Hi All, I am using F5 default cookie for persistence defined on virtual server which is the same name for both datacenter. I use irule to route the traffic to the original data center in case traffic goes to another data center. But it looks like the persistence cookie is getting reset when it goes to opposite data center since the persistence cookie identifying the server is invalid for this new data center. Now when traffic is routed back to original data center again the cookie is invalid, so the session goes to a different server. Now how can i stop the persistence cookie being reset when it goes to opposite data center and kick off routing to original data center before any cookie is reset?
1 Reply
- Brad_Parker
Cirrus
A possible solution I have got to work is as follows and the server still sees the traffic as originating from the true source IP:
- Create your pools with priority activation.
- Add nodes from both data centers to your pool
- Set the servers in the local data center to priority 10
- Set the servers in the remote data center to priority 1
- Make sure your persistence cookie has the same name in both data centers and is only applied to your virtual server for the application
- Create a SNAT pool in both data centers
- Create a standard virtual server in each DC that has a source of your SNAT pool IPs and 0.0.0.0/0:80 as the destination
- Apply the first iRule to the virtual servers handling incoming traffic for you application and the second iRule to the virtual servers that are listening for traffic form your SNAT pool IPs.
when HTTP_REQUEST { HTTP::header insert sIP [IP::client_addr] } when LB_SELECTED { if { [LB::server priority] == 1 } { snatpool interDC HTTP::header insert dIP [LB::server addr] } else { snat none return } }when HTTP_REQUEST { if { [HTTP::header exists "sIP"] && [HTTP::header exists "dIP"] } { persist none snat [HTTP::header values "sIP"] node [HTTP::header values "dIP"] } else { reject } }This can maintain persistence to the destination server even if a user hops over to your other data center.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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