-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhaproxy.cfg
More file actions
50 lines (42 loc) · 1.41 KB
/
haproxy.cfg
File metadata and controls
50 lines (42 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
global
log stdout format raw local0 info
maxconn 4096
defaults
log global
mode http
option httplog
option dontlognull
option http-server-close
option forwardfor except 127.0.0.0/8
timeout connect 5000ms
timeout client 50000ms
timeout server 50000ms
# Statistics page
frontend stats
bind *:8404
stats enable
stats uri /stats
stats refresh 10s
# Secure with basic auth - username: admin, password: set via HAPROXY_STATS_PASSWORD env var
stats auth admin:"${HAPROXY_STATS_PASSWORD}"
stats admin if TRUE
# Main frontend
frontend http-in
bind *:8080
# Default backend
default_backend proxy-nodes
# Backend with 3 proxy nodes
backend proxy-nodes
balance roundrobin
# Sticky sessions for admin routes using cookie
# HAProxy inserts SERVERID cookie that maps to specific backend
# If node fails, user will be redirected to another node and need to re-login
cookie SERVERID insert indirect nocache httponly
# Health checks on /health endpoint
option httpchk GET /health
http-check expect status 200
# Three proxy nodes
# cookie value must match server name for sticky sessions
server proxy-1 proxy-1:8080 check cookie proxy-1 inter 10s fall 3 rise 2
server proxy-2 proxy-2:8080 check cookie proxy-2 inter 10s fall 3 rise 2
server proxy-3 proxy-3:8080 check cookie proxy-3 inter 10s fall 3 rise 2