Skip to content

Instantly share code, notes, and snippets.

@sriperinkulam sriperinkulam/HAProxy Config Secret
Created Feb 4, 2020

Embed
What would you like to do?
frontend localhost80 #Front end for port 80, does a redirect to port 443
bind *:80
mode http
redirect scheme https code 301 if !{ ssl_fc }
frontend localhost443 #Listens on port 443
bind *:443
option tcplog
mode tcp
acl tls req.ssl_hello_type 1
tcp-request inspect-delay 5s
tcp-request content accept if tls
acl domain1_com req.ssl_sni -i xyz.com
acl domain2_com req.ssl_sni -i abc.com
use_backend b_domain1_com if domain1_com
use_backend b_domain2_com if domain2_com
default_backend b_default
backend b_default
mode tcp
option tcplog
server srv_default 127.0.0.1:443
backend b_domain1_com
mode tcp
option tcplog
server srv_domain1 192.168.x.xx:443
backend b_domain2_com
mode tcp
option tcplog
server srv_domain2 192.168.x.xx:443
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.