Is there a way to empty a previous cookie based on source ip? I need this to be done because of loadbalancing issues.

regards Geert

  • Can you share more details about your setup? – initall Jan 28 '13 at 14:07
  • basicly : a sitecrawler tries to crawl certain website. this website is proxied through 3 Proxyservers. but because of the cookie it always goes to the same server. the idea is to empty the cookie based on the ip of the crawlerserver so that it goes to other elements aswell. – Geert Torsin Jan 28 '13 at 14:19
  • If you are able to identify the crawler independently of the IP address, why don't you just give it a new cookie? (A certain cookie for a specific proxy or just outdating the cookie) – initall Jan 28 '13 at 14:52
  • should work, but I am overlooking the correct parameter to outdate it. – Geert Torsin Jan 28 '13 at 14:56
  • 2
    You set an empty value and the expire date to the past, e.g. one year. And make sure you use the same path parameter. – initall Jan 28 '13 at 15:04

You could always use Disallow: /cookies in a robots.txt based on the user agent?

Or if you must drop a cookie to the crawlers, as described above by initall, to delete a cookie, simply have it expire immediately by setting expire to some time before the current time. If you specified a domain and path for the cookie, you have to do the same when you delete it:

| improve this answer | |
  • the problem is that those cookies are set by the loadbalancer, to which I have access ... – Geert Torsin Jan 28 '13 at 18:27
  • <script type="text/javascript"><!-- function delCookie(name) { var ThreeDays = 3*24*60*60*1000; var expDate = new Date(); expDate.setTime (expDate.getTime() - ThreeDays); document.cookie = name + "=ImOutOfHere; expires=" + expDate.toGMTString(); } --></script> – ev4nsj Jan 28 '13 at 18:29
  • Take a look at Session persistence on your load balancer and set to something like round robin or least connection, as they will drop a session cookie to retain persistence (sticky sessions).. – ev4nsj Jan 28 '13 at 18:33
  • I have no access to the loadbalancer, nor will I ever get it ;-) made a type in last post ;-) ëastiest" way for mne would be to empty the cookie – Geert Torsin Jan 29 '13 at 6:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.