haproxy-with-sni-sample.cfg 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # Uses proxy protocol in HAProxy in combination with SNI to preserve the original host address
  2. # Update the config.json to work with HAProxy
  3. # Specify the IP addrehostname that the traffic will come from HAProxy (this might not be the address that is bound to the listener)
  4. # "tlsOffload": "10.1.1.10",
  5. #
  6. # Specify the HAPRoxy URL with the hostname to get the certificate
  7. # "certUrl": "https://mc.publicdomain.com:443/"
  8. frontend sni-front
  9. bind 10.1.1.10:443
  10. mode tcp
  11. tcp-request inspect-delay 5s
  12. tcp-request content accept if { req_ssl_hello_type 1 }
  13. default_backend sni-back
  14. backend sni-back
  15. mode tcp
  16. acl gitlab-sni req_ssl_sni -i gitlab.publicdomain.com
  17. acl mc-sni req_ssl_sni -i mc.publicdomain.com
  18. use-server gitlabSNI if gitlab-sni
  19. use-server mc-SNI if mc-sni
  20. server mc-SNI 10.1.1.10:1443 send-proxy-v2-ssl-cn
  21. frontend cira-tcp-front
  22. bind 10.1.1.10:4433
  23. mode tcp
  24. option tcplog
  25. tcp-request inspect-delay 5s
  26. default_backend mc-cira-back
  27. backend cira-tcp-back
  28. mode tcp
  29. server mc-cira 10.1.1.30:4433
  30. frontend mc-front-HTTPS
  31. mode http
  32. option forwardfor
  33. bind 10.1.1.10:1443 ssl crt /etc/haproxy/vm.publicdomain.net.pem accept-proxy
  34. http-request set-header X-Forwarded-Proto https
  35. option tcpka
  36. default_backend mc-back-HTTP
  37. backend mc-back-HTTPS
  38. mode http
  39. option forwardfor
  40. http-request add-header X-Forwarded-Host %[req.hdr(Host)]
  41. option http-server-close
  42. server mc-01 10.1.1.30:443 check port 443 verify none
  43. # In the event that it is required to have TLS between HAProxy and Meshcentral,
  44. # Remove the tls_Offload line and replace with trustedProxy
  45. # Specify the IP addrehostname that the traffic will come from HAProxy (this might not be the address that is bound to the listener)
  46. # "trustedProxy": "10.1.1.10",
  47. # and change the last line of backend mc-back-HTTPS to use HTTPS by adding the ssl keyword
  48. # server mc-01 10.1.1.30:443 check ssl port 443 verify none