Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Haproxy cookie not used

    pfSense Packages
    2
    3
    2.8k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      jst
      last edited by

      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,
      jst.

      1 Reply Last reply Reply Quote 0
      • R
        rkelleyrtp
        last edited by

        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:

        #!/bin/sh
        
        . /etc/rc.subr
        
        name="haproxy"
        rcvar=`set_rcvar`
        command="/usr/local/sbin/haproxy"
        : ${haproxy_enable="YES"}
        
        start_cmd="haproxy_start"
        stop_postcmd="haproxy_stop"
        
        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…

        1 Reply Last reply Reply Quote 0
        • J
          jst
          last edited by

          this is what 's missing:

          cookie SERVERID insert indirect

          it would be nice is this could be done automatically.

          tnx in advance,
          jst.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.