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

    Server line disappears from HAProxy config

    Scheduled Pinned Locked Moved Cache/Proxy
    5 Posts 2 Posters 593 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.
    • B
      blueh2o
      last edited by

      I'm having a problem where occasionally I go to access a particular backend, and I get a 503 error. I go to look at the HAProxy config, and the server statement for that backend is missing:

      backend Zoneminder_ipvANY
      	mode			http
      	id			106
      	log			global
      	timeout connect		30000
      	timeout server		30000
      	retries			3
      	option			httpchk OPTIONS / 
      
      

      If I restart the service, the line reappears:

      backend Zoneminder_ipvANY
      	mode			http
      	id			106
      	log			global
      	timeout connect		30000
      	timeout server		30000
      	retries			3
      	option			httpchk OPTIONS / 
      	server			Zoneminder 192.168.1.13:443 id 107 ssl check inter 60000  verify none 
      

      I am baffled as to why this is happening.

      P 1 Reply Last reply Reply Quote 0
      • P
        PiBa @blueh2o
        last edited by

        @blueh2o
        Is the server defined with a dns name?

        1 Reply Last reply Reply Quote 0
        • B
          blueh2o
          last edited by

          Yes, it is.

          P 1 Reply Last reply Reply Quote 0
          • P
            PiBa @blueh2o
            last edited by

            @blueh2o
            Then i suspect the php code (sometimes) fails to resolve that name to the proper IP when the config was generated. Can you check when the configuration was generated and if 'something' special was going on at that time? Perhaps the dns server used wasn't reachable? Or it was during a reboot while not all services were running yet?

            When the name cannot be resolved the server is skipped as otherwise haproxy would fail to start. Can you perhaps configure the dns-resolver settings of haproxy itself on the settings tab? That should get the server-name instead of the IP in the configuration and allow haproxy to resolve the name by itself at runtime.

            Might also need to add this in the advanced global textbox setting:

            defaults
                # never fail on address resolution
                default-server init-addr last,libc,none
            

            That way it should avoid the situation above. It would still return the 503 while dns doesn't work, but when dns starts working haproxy would resolved it by itself.

            1 Reply Last reply Reply Quote 0
            • B
              blueh2o
              last edited by

              Thank you for these suggestions. I'll try them.

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