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

    Haproxy custom 503 error pages not working when set on backend, only when set on the primary front end.

    Scheduled Pinned Locked Moved Cache/Proxy
    1 Posts 1 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.
    • xanaroX
      xanaro
      last edited by xanaro

      If anyone has worked out how to use custom 503 error pages per host/backend using the pfSense implementation of Haproxy, could you please share how you did it?

      I have a Front end which handles the certs/SNI, then I have a shared front end below that handles ACL and Actions (which backend to use) this shared front end refers to the cert/sni as the primary front end.

      2021-11-01_17-27.png

      I have some hosts/backends that are only accessible to networks/IPs that are defined in the AdminNet pfsense firewall Networks alias.

      ACL:
      2021-11-01_17-31.png

      Action:
      2021-11-01_17-32.png

      If a users IP/network is not on the AdminNet alias, then haproxy generates a 503 page.

      Haproxy has provision for custom Files which can be used to display custom 503 pages.
      If I set a custom 503 page on the cert/sni front end it works, but there is no way to have custom 503 pages per host/backend if you do this way.

      So I noticed custom error pages can even be set on the shared front end or the backends, neither of those spots work for me. If I remove the custom 503 page from the primary front end, and try to set it on the individual backends, then the custom 503 pages never load, instead it just gives you the generic 503 page that haproxy generates.

      also here is a copy of my custom 503 page:

      HTTP/1.0 503 Service Unavailable
      Cache-Control: no-cache
      Connection: close
      Content-Type: text/html
      
      <html><head><title>Page not found</title></head><body>
      <h2>Page not found. <a href="https://www.example.com">return home</a></h2>
      </body></html>
      

      If anyone has worked out how to use custom 503 error pages per host/backend using the pfSense implementation of Haproxy, could you please share how you did it?

      There are fields for custom error pages on regular front ends, shared front ends, as well as backends, so I am assuming there should be a way to get them to work.

      for instance here is where you would find the field on the backend settings:
      2021-11-01_17-03.png

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