Haproxy cookie not used

  • great having haproxy in pfSense!

    When monitoring the cookies I don't find the server cookie. I don't get the haproxy to use the cookie to determine witch server to use.

    using haproxy 0.27, on the servers tab I have a cookie value selected (value  'a' , so just the letter a, no spaces, …)

    the text specifies    ... See also the "cookie" keyword in backend section.

    i don't seem to find a backend section, in the frontend section i can't find a cookie specification.
    i 've tried both balance options, round robin & source.

    How do  i get ha-proxy to use the cookies?
    deselecting both the balance options is not possible.

    tnx in advance!
    best regards,

  • I think your best bet is to manually add these options to the haproxy configuration file and bypass the GUI all together.  Unfortunately, any changes you make to the /var/etc/haproxy.cfg file will automatically get overwritten when you restart the process.  Here is how to fix that:

    • Get a shell (as admin) on your pfSense box

    • Go to the /usr/local/etc/rc.d directory

    • Backup the haproxy.sh script

    • Edit the haproxy.sh script and make it look like this:

    . /etc/rc.subr
    : ${haproxy_enable="YES"}
    load_rc_config $name
    haproxy_start () {
            echo "Starting haproxy."
            /usr/local/sbin/haproxy -f /var/etc/haproxy.cfg -D -p /var/run/haproxy.pid
    haproxy_stop () {
            echo "Stopping haproxy."
            pkill -HUP  haproxy
    run_rc_command "$1"
    • Edit the /var/etc/haproxy.cfg file by hand and make your changes

    • Restart the haproxy app using the command, "/usr/local/etc/rc.d/haproxy restart"

    Note:  If you have a pair of pfSense boxes running in a CARP configuration, you will need to do this on both boxes.  In addition, each time you make a change to /var/etc/haproxy.cfg, you will need to update the other pfSense box.

    Hope this helps…

  • this is what 's missing:

    cookie SERVERID insert indirect

    it would be nice is this could be done automatically.

    tnx in advance,

Log in to reply