Forum Discussion
Muhammad_64435
Nimbostratus
Aug 09, 2011How to clean LTM cookies
Hello,
We host multiple websites on a single domain hence single virtual server and single irule for all those websites. Consumer requests to a particular website is maintained through Cookie persistence with 1 hour expiry. Cookie persistence is applied through Cookie persistence profile applied on Virtual server.
The issue we are seeing is when a consumer jumps a website LTM starts seeing two or more cookies and send the request to the wrong pool:node pair.
Is something similar to the following possible in iRules ?
HTTP_REQUEST {
if { grep BIGipServer [HTTP::cookie names] > 1 } {
Remove all bigip cookies starting with BIGipServer
HTTP::cookie remove "BIGipServer*"
}
There are other cookies present in the header from application etc. So can't remove "all" cookies.
I appreciate any help or idea.
Thank you,
2 Replies
- Michael_Yates
Nimbostratus
You said in your post that you are using a single Virtual Server and have multiple websites pointed to it.
We host multiple websites on a single domain hence single virtual server and single irule for all those websites.
If you are routing the traffic for the individual websites via an iRule, could you post the iRule that is doing the traffic routing so that we can see it?
Your second statement could be an indicator that there is something wrong in the iRule.
The issue we are seeing is when a consumer jumps a website LTM starts seeing two or more cookies and send the request to the wrong pool:node pair. - Muhammad_64435
Nimbostratus
Thanks for checking ...
Here is some background and explanation :
Basically, I browse the first site linkID=ABC and works fine using the pool ABC. Verified in the browser cache that i got the cookie name "BIGipServerABC".
I leave the first browse open and open a second browser and start browsing the second site linkID=XYZ and got the cookie "BIGipServerXYZ.
My application works in a way that after few pages it looses the "linkID=" part in the URI then i have to rely on the Cookie .. and when I am browsing the second site XYZ and reaches to the point where i need to rely on the cookie then it breaks. It breaks because browser cache has both cookies and it send both cookies with a request and when the iRule execute the following line
set cID [findstr [HTTP::cookie names] BIGipServer 11 " " ]
it suppose to pick XYZ site cookie but instead it picks up ABC cookie and send the request to ABC pool and breaks.
Here is full codewhen HTTP_REQUEST { set uri [HTTP::uri] log local0. "http request uri -> $uri " Catch 1: for capturing cIDs from query like URI e.g. "/shopperDisplay?linkID=ABC&shopperstatus=null" or similar situation will catch ABC here set cID [URI::query $uri "linkID"] log local0. "http request cID -> $cID " if { $cID == "" } { if { $cID == "" } { log local0. "extract the cID from COOKIE now " will catch ABC again here set cID [findstr [HTTP::cookie names] BIGipServer 11 " " ] Catch 3: even Cookie doesn't exists -- BAD request if { $cID == "" } { log local0. "BAD REQUEST -- redirect to sorry page" HTTP::redirect "http://sorry.domain.com/bigip/sorry.html?[HTTP::host][HTTP::uri]" } } } pool $cID }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects
