Skip to content

Instantly share code, notes, and snippets.

@erikkaplun
Created October 12, 2014 22:46
Show Gist options
  • Save erikkaplun/49aad4d93b08cfa6d055 to your computer and use it in GitHub Desktop.
Save erikkaplun/49aad4d93b08cfa6d055 to your computer and use it in GitHub Desktop.
global
log 127.0.0.1 local0
# log 127.0.0.1 local1 notice
#log loghost local0 info
#maxconn 4096
chroot /usr/share/haproxy
user haproxy
group haproxy
daemon
#debug
#quiet
defaults
log global
mode http
option httplog
option dontlognull
retries 3
option redispatch
maxconn 2000
timeout connect 5000
timeout client 50000
timeout server 50000
######## demo.smth & stage.smth ##########
### HTTPS
# Single VIP
frontend https-in
bind *:8443
mode tcp
option tcplog
tcp-request inspect-delay 5s
tcp-request content accept if { req_ssl_hello_type 1 }
default_backend https-out
# Using SNI to take routing decision
backend https-out
mode tcp
acl stage req_ssl_sni -i stage.smth
acl demo req_ssl_sni -i demo.smth
use-server stage if stage
use-server demo if demo
# use-server server3 if !demo1 !demo2 # TODO
option ssl-hello-chk
server stage 127.0.0.1:10443 check
server demo 127.0.0.1:11443 check
# server server3 10.0.0.13:443 check # TODO
### HTTP
frontend http-in
bind *:8080
mode http
acl stage hdr(host) -i stage.smth
acl demo hdr(host) -i demo.smth
use_backend http-out-stage if stage
use_backend http-out-demo if demo
backend http-out-stage
server http 127.0.0.1:10080 #cookie A check
backend http-out-demo
server http 127.0.0.1:11080 #cookie A check
################################################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment