Skip to content

Instantly share code, notes, and snippets.

@habnai
Last active December 16, 2022 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save habnai/d9bf4540e0b21e7e0d95ea61514b8808 to your computer and use it in GitHub Desktop.
Save habnai/d9bf4540e0b21e7e0d95ea61514b8808 to your computer and use it in GitHub Desktop.
haproxy_ssl_passthrought
global
maxconn 5000
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
defaults
log global
mode tcp
option httplog
option dontlognull
timeout http-request 5s
timeout connect 5000
timeout client 2000000
timeout server 2000000
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http
frontend redirect
bind *:80
mode http
redirect scheme https if !{ ssl_fc }
frontend HomeServer
bind *:443
option tcplog
mode tcp
option forwardfor header X-Real-IP
http-request set-header X-Real-IP %[src]
tcp-request inspect-delay 5s
tcp-request content accept if { req_ssl_hello_type 1 }
use_backend cloud if { req_ssl_sni -m end web1.web.com }
backend web1
mode tcp
balance roundrobin
# Add an entry for each of your backend servers and their resolvable hostnames
server web1_server x.x.x.x:443 check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment