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

HAProxy backend port changes are not applied

Scheduled Pinned Locked Moved Cache/Proxy
6 Posts 5 Posters 1.4k Views
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.
  • S
    safe
    last edited by Feb 27, 2023, 4:17 PM

    In a basic setup with a frontend and a backend, set the port to 80 in the backend. Save and apply the settings. You can now reach the backend service running on port 80. If you on the same backend also have a different service on for example port 81, and you change the backend port to 81, then save and reload, your browser will still see the service on port 80. It doesn't matter if you restart the HAProxy service, stop and start it, it is still serving the service on port 80. If you reboot the whole PFSense box, it switches to port 81.

    I found out that the problem is related to the file /tmp/haproxy_server_state. This file shows the old port even though the generated haproxy.cfg file shows the correct port. If I stop the HAProxy service, then delete this file and start the service again, it will serve the correct backend port.

    Is this a bug, or is it intentionally?

    23.01, with haproxy-devel (haproxy-2.6.6)
    Thanks

    R P 2 Replies Last reply Apr 16, 2024, 6:31 PM Reply Quote 3
    • R
      rpontual @safe
      last edited by Apr 16, 2024, 6:31 PM

      @safe I still see the same problem.

      PFSENSE 23.09.1
      HAPROXY 2.8.2 (package v 0.63_2)

      S 1 Reply Last reply Apr 23, 2024, 12:33 PM Reply Quote 0
      • S
        safe @rpontual
        last edited by Apr 23, 2024, 12:33 PM

        @rpontual As a workaround, if I remember correctly, you can rename the backend when saving the new port, then rename it back (if you want to), and save again. Then it should work. Easier than deleting the file.

        1 Reply Last reply Reply Quote 0
        • P
          pfpv @safe
          last edited by Apr 28, 2024, 7:02 PM

          Wow! I struggled for hours, came here to report this problem and found this thread. I am on 2.7.2 CE and haproxy-devel 0.63_2. devel and non-devel packages have the same version (strange) but different dependencies. First I thought I made a mistake installing devel but it looks like the non-devel package has the same problem.

          My findings are exactly as @safe's. I can only add that after I restart the haproxy service I can see in stats that the "backend" line of my backend shows something like 15s UP but the associated "MyBackendName" line shows something like 8m 23s UP, as it was never killed and restarted.

          The workaround I found is to clone the backend, delete the old one and rename the new and double-check the frontend but I will try @safe's workaround that seems a little easier.

          Since this hasn't gained attention since Feb. last year, how can report this to the developer?

          1 Reply Last reply Reply Quote 0
          • B
            bbrendon
            last edited by Jul 7, 2024, 5:27 AM

            OMFG this workaround is still valid. I just spent an hour wondering what I was doing wrong.

            1 Reply Last reply Reply Quote 0
            • I
              ix-kilian
              last edited by Jul 16, 2024, 4:07 PM

              Seems to be related to the state file: /tmp/haproxy_server_state

              Login via CLI, delete the file and reload haproxy - worked for me.

              1 Reply Last reply Reply Quote 0
              • P pfpv referenced this topic on Jul 19, 2024, 8:03 PM
              • First post
                Last post
              Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                [[user:consent.lead]]
                [[user:consent.not_received]]