How to setup a reverse proxy via HAProxy?

Note: always replace “client.com” with your hostname, “client.backend.verbolia.com” with the given verbolia hostname and “/path_to_verbolia/” with the agreed routed url pattern.

  • Append your haproxy configuration.


    Edit your haproxy.cfg file and add a Resolver section to enable DNS record update without needing to restart the application:

resolvers publicdns
    nameserver cloudflare 1.1.1.1:53
    nameserver google 8.8.8.8:53
    hold valid    300s

  • Modify the Frontend section:


    Add a “use_backend if” condition line in your frontend section:

frontend www-http
  ...
  use_backend verbolia-backend if { path_beg /path_to_verbolia/ }

  • And add the backend definition:

backend verbolia-backend
 mode http
 option forwardfor
 http-request add-header X-Forwarded-Proto https if { ssl_fc }
 http-request set-header Host http://client.backend.verbolia.com
 server web-verbolia client.backend.verbolia.com:443 ssl sni req.hdr(Host) ssl verify none resolve-prefer ipv4 resolvers publicdns

  • Restart haproxy

systemctl restart haproxy