Advertisement
Guest User

HAProxy config with SSL Passthrough and Termination

a guest
Feb 28th, 2017
1,262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. global
  2. log 127.0.0.1 local0 debug
  3. chroot /var/lib/haproxy
  4. stats socket /var/lib/haproxy/admin.sock level admin
  5. pidfile /var/lib/haproxy/pid
  6. stats timeout 30s
  7. daemon
  8. tune.ssl.default-dh-param 2048
  9. ssl-server-verify none
  10. crt-base /etc/ssl/certs/
  11.  
  12. defaults
  13. log global
  14. option tcplog
  15. option http-server-close
  16. timeout connect 5000
  17. timeout client 50000
  18. timeout server 50000
  19.  
  20. frontend stats
  21. bind *:9999
  22. mode http
  23. stats enable
  24. stats refresh 30s
  25. stats show-node
  26. stats auth admin:admin
  27. stats show-desc Super Awesome Stats Page! YAY!
  28. stats uri /haproxy?stats
  29.  
  30. frontend http_front
  31. bind *:80
  32. default_backend http_back
  33. mode http
  34. # Placeholder with funny page. Do we need to redirect to pt 443?
  35.  
  36. frontend https_Main
  37. bind *:443
  38. mode tcp
  39. mode tcp
  40. tcp-request inspect-delay 5s
  41. tcp-request content accept if { req_ssl_hello_type 1 }
  42. use_backend %[req.ssl_sni,lower,map_dom(/etc/haproxy/sni2backend.map,nonSNIhttps_back)]
  43. # Check the mapping for sni headers. If SNI info not fount, go to nonSNIhttps_back->nonSNIhttps_front
  44.  
  45. frontend nonSNIhttps_front
  46. bind 127.0.0.1:9443 ssl crt test01.pem crt test02.pem
  47. mode http
  48. option forwardfor
  49. use_backend %[req.hdr(host),lower,map_dom(/etc/haproxy/domain2backend.map,http_back)]
  50. # This is the fallback to look for certs. If the domain is not found in the main FrontEnd, look here
  51.  
  52. backend nonSNIhttps_back
  53. mode tcp
  54. server nonSNIhttps_front 127.0.0.1:9443 check check-ssl
  55.  
  56. backend http_back
  57. mode http
  58. server localhost 127.0.0.1:9998 check
  59.  
  60. backend test01
  61. mode http
  62. server test01 172.20.0.141:80 check
  63.  
  64. backend test02
  65. mode http
  66. server test02 172.20.0.142:80 check
  67.  
  68. backend dev42
  69. mode tcp
  70. server dev42 172.20.0.42:443 check
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement