First off, thank you to all the developers of HAProxy, it is an amazing piece 
of software that easily rivals those that cost thousands of dollars more!
 
I'll be the first to admit that I am very new to using HAProxy, but we have 
been using it to balance a not very well written application ( 
http://www.blackboard.com/ ). Using the "insert postonly indirect" cookie 
method, I was attempting to remove the cookie when users would logout, allowing 
the machine to re-balance for the next user (this application is used in school 
computer labs, so a computer might stay on the whole day but be used on and 
off). 
 
I was having a lot of trouble because when the cookie was set, it was with 
"Path=/", but when being cleared there was no "Path" in the set cookie header, 
and because the logout page was in a different place of the website (which I 
couldn't change), the cookie would not be cleared. I don't know if this would 
be a problem for anyone other than me (as our HTTP application is so 
un-adjustable), but just in case, I have included the patch I used. Maybe it 
will help someone else.
 
Thanks again for all your work!
 - William Turner
Wayne RESA
 
 

Email disclaimer: 
This email is intended only for the use of the addressee(s) named herein. It 
may contain legally privileged and confidential information. If you are not the 
intended recipient, or an authorized representative, consider this notification 
that any review, copying, or distribution of this email or attachments is 
prohibited. If this email was received in error, please immediately notify the 
sender by return email and delete the email. Thank you.
--- haproxy-1.4.0/src/cfgparse.c        2010-02-26 08:55:22.000000000 -0500
+++ haproxy-1.4.0_mod_clear_cookie/src/cfgparse.c       2010-03-01 
13:12:04.000000000 -0500
@@ -2112,16 +2112,16 @@
                rule->rdr_len = strlen(destination);
                if (cookie) {
                        /* depending on cookie_set, either we want to set the 
cookie, or to clear it.
-                        * a clear consists in appending "; Max-Age=0" at the 
end.
+                        * a clear consists in appending "; path=/; Max-Age=0;" 
at the end.
                         */
                        rule->cookie_len = strlen(cookie);
                        if (cookie_set)
                                rule->cookie_str = strdup(cookie);
                        else {
-                               rule->cookie_str = malloc(rule->cookie_len + 
12);
+                               rule->cookie_str = malloc(rule->cookie_len + 
21);
                                memcpy(rule->cookie_str, cookie, 
rule->cookie_len);
-                               memcpy(rule->cookie_str + rule->cookie_len, "; 
Max-Age=0", 12);
-                               rule->cookie_len += 11;
+                               memcpy(rule->cookie_str + rule->cookie_len, "; 
path=/; Max-Age=0;", 21);
+                               rule->cookie_len += 20;
                        }
                }
                rule->type = type;

Reply via email to