HAProxy and "sharding"

first, remove the equal sign after your cookie name, otherwise it will never match. Second, please ensure that your server correctly sets the "mysession" cookie, as the cookie prefix mode relies on the server to set the cookie. If it does not, use the insert mode instead. Third, please add "option httpclose" in your config, because if there is any sort of keepalive, haproxy won't see the cookie (or will not be able to mangle it).

Hoping this helps,
Willy


Your config is OK. You can check in the logs that the cookie presented by the client was recognized and used. It will put the letter 'V' at the first position in the 4-character status flags (eg: VN--). First requests without a valid cookie will have a 'N' instead. Please check the doc for more info, you'll have all that in section 8.5. You can also enable the stats page and check them while you browse. You should see that the "LbTot" column only increases once per new client and is not incremented anymore for a same client.


You can try the capture cookie feature (all depends of the served application) in your listen section, see :http://haproxy.1wt.eu/download/1.3/doc/configuration.txt:

Only the first cookie is captured. Both the "cookie" request headers and the "set-cookie" response headers are monitored. This is particularly useful to check for application bugs causing session crossing or stealing between users, because generally the user's cookies can only change on a login page.

Example: capture cookie ASPSESSION len 32


By the way it seems like your config is ok.


listen corporate_web_live
  bind 1.2.3.4:80  # site1.com
  bind 1.2.3.5:80  # site2.com
    option httpchk HEAD /server.txt HTTP/1.0
    cookie HAPSRV insert postonly indirect
    server webapp-corp-1 10.0.0.1:80 weight 50 maxconn 150 slowstart 30s cookie WAC1 check
    server webapp-corp-2 10.0.0.2:80 weight 50 maxconn 150 slowstart 30s cookie WAC2 check
    server webapp-corp-3 10.0.0.3:80 weight 50 maxconn 150 slowstart 30s cookie WAC3 check
    server webapp-corp-4 10.0.0.4:80 weight 50 maxconn 150 slowstart 30s cookie WAC4 check
    server webapp-corp-5 10.0.0.5:80 weight 50 maxconn 150 slowstart 30s cookie WAC5 check
    server webapp-corp-6 10.0.0.6:80 weight 50 maxconn 150 slowstart 30s cookie WAC6 check

Note the use of 'insert', 'postonly' and 'indirect' in the example above - this causes HAproxy to chuck in a cookie as required to the streams which traverse it.