Skip to content

Instantly share code, notes, and snippets.

@cupracer
Last active March 13, 2022 10:06
Show Gist options
  • Save cupracer/3520202285654ca3029a7d7634d88081 to your computer and use it in GitHub Desktop.
Save cupracer/3520202285654ca3029a7d7634d88081 to your computer and use it in GitHub Desktop.
HAproxy HTTP + HTTPS passthrough (roughly created, but works for me)
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
log-send-hostname
maxconn 4096
pidfile /var/run/haproxy.pid
user haproxy
group haproxy
daemon
stats socket /var/run/haproxy.stats level admin
ssl-default-bind-options no-sslv3
ssl-default-bind-ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:AES128-GCM-SHA256:AES128-SHA256:AES128-SHA:AES256-GCM-SHA384:AES256-SHA256:AES256-SHA:DHE-DSS-AES128-SHA:DES-CBC3-SHA
defaults
balance roundrobin
log global
mode http
option redispatch
option httplog
option dontlognull
option forwardfor
timeout connect 5000
timeout client 50000
timeout server 50000
listen stats
bind :1936
mode http
stats enable
timeout connect 10s
timeout client 1m
timeout server 1m
stats hide-version
stats realm Haproxy\ Statistics
stats uri /
stats auth stats:stats
frontend port_443
bind :::443
mode tcp
default_backend SERVICE_web_ssl
frontend port_80
bind :::80
mode tcp
option tcplog
default_backend SERVICE_web
backend SERVICE_web
server web_1 <ip-address>:80 check inter 2000 rise 2 fall 3
backend SERVICE_web_ssl
mode tcp
option ssl-hello-chk
server web_1 <ip-address>:443 check inter 2000 rise 2 fall 3
@cupracer
Copy link
Author

cupracer commented Jan 26, 2018

replace <ip-address> with target IP

@flexie-crm
Copy link

That wont work as you can not get the Real IP on your web server... TCP Mode is tricky

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment