Forum Discussion

pvaughan's avatar
pvaughan
Icon for Nimbostratus rankNimbostratus
Jun 25, 2012

cookie persistance Site affinity Irule help

Hey Guys and gals, need some help with an irule. I have been tasked with the following requirement and need to write an irule to accomplish this task.

 

We have 2 data centers with a gtm handing out dns and ltms doing the local loadbalaincing. When a client does a write request to the application it will insert a cookie marking the site it came from for example dc1 or dc2. My developers want to make sure if the ldns times out and the gtm sends the client a different site the ltm will see the wrong site in the cookie and send the packets to the correct site. Thanks

2 Replies

  • Hi,

     

     

    You can check HTTP requests in the HTTP_REQUEST event for a cookie and value using [HTTP::cookie value $cookie_name]. You can send a redirect to a site specific hostname using 'HTTP::redirect "http://site2.example.com[HTTP::uri]'.

     

     

    https://devcentral.f5.com/wiki/iRules.http__cookie.ashx

     

    https://devcentral.f5.com/wiki/iRules.http__redirect.ashx

     

    https://devcentral.f5.com/wiki/iRules.http__uri.ashx

     

     

    Aaron
  • gtm is going to resolve the dns request globally so I don't think a redirect will work. I would rather have the ltm proxy the connection and send it to the other ltm. So if the ltm sees the cookie for the wrong site then snat and send the request to the other ltm