haproxy stick store-response on header

Discussion in 'Server Operation' started by kperas, Jan 7, 2015.

  1. kperas

    kperas New Member

    Hi all, i want to quit with nginx and use haproxy instead. I recently noticed, that my load balancing dispersion is not working the way i thought it does. I have 8 Backend Servers running a java application on tomcat, a load balancer (nginx or in future hopefully haproxy) wich does ssl offloading, client ip (not really client ip, i´ll get there...) x-forwarded for in request header and load balancing with simple client ip hash persistence.

    Because i had two Hardwaremachines running back in 2014 the "not so good" load balancing dispersion wasnt a problem, and i did not even recognize it. But now i have 8 little virtual machines and want to balance over them in a good manner. I cant use client ip persistence, because there are 3 other proxies, wich are pointing an my load balancer instance. so i only see three client ips for like 90 percent of the clients. result: i have 70 percent of the clients on one machine ... and 3 machines almost without any session.

    The app developers did me a favour and put the jessesionid in the header wich looks like this:

    <head>

    <meta content="222EA735E1962FB79D7AFCFE48726C78" name="sessionid">
    .....
    </head>

    how can a have session persistence sticky on that sessionid in the header?

    i guess i need something like this:

    frontend
    stick table ?

    backend mysite
    stick store response hdr(sessionid)
     
  2. kperas

    kperas New Member

    Or in simple words: how can a realize session stickiness on that sessionid in the header?

    <head>

    <meta content="222EA735E1962FB79D7AFCFE48726C78" name="sessionid">
    .....
    </head>


    i guess i need something like this:

    frontend
    stick table ... # i dont know/understand tthe syntax here

    backend mysite
    stick store response hdr(sessionid) # # i dont know/understand tthe syntax here

    Any help would be great!
     
  3. kperas

    kperas New Member

    If I do this:

    frontend mysite
    bind *:443
    mode http
    stick-table type string len 32 size 30k expire 60m

    backend mysite
    balance roundrobin
    stick store-response hdr(sessionid)
    server on3 10.194.29.103:8080
    server on4 10.194.29.104:8080


    I get this:

    # /etc/init.d/haproxy restart
    * Restarting haproxy haproxy [ALERT] 008/141530 (9308) : Proxy 'mysite': stick-table 'mysite' used but not configured.
    [ALERT] 008/141530 (9308) : Fatal errors found in configuration.

    What is wrong here?
     

Share This Page