Skip to content

Instantly share code, notes, and snippets.

@haani-niyaz
Created May 9, 2018 00:53
Show Gist options
  • Save haani-niyaz/baeaebec8bd5ec7b148a7359107fc19e to your computer and use it in GitHub Desktop.
Save haani-niyaz/baeaebec8bd5ec7b148a7359107fc19e to your computer and use it in GitHub Desktop.
How to use DNS name backends in haproxy
global
log 127.0.0.1 local2
pidfile /var/run/haproxy.pid
user haproxy
group haproxy
maxconn 1000
defaults
log global
mode http
option httplog
option dontlognull
timeout connect 50000ms
timeout client 50000ms
timeout server 50000ms
resolvers dns
nameserver dns-0 10.255.255.131:53
nameserver dns-1 10.255.255.132:53
frontend api
bind *:9000
bind *:443
mode tcp
option tcplog
default_backend api-backend
backend api-backend
balance roundrobin
mode tcp
server site-1 api1.com.au:443 resolvers dns check verify none inter 1000
server site-2 api2.com.au:443 resolvers dns check verify none inter 1000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment