-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathhaproxy.cfg.template
59 lines (47 loc) · 1.98 KB
/
haproxy.cfg.template
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
51
52
53
54
55
56
57
58
global
pidfile {{.PidFile}}
log 127.0.0.1 local0 info
defaults
mode http
clitimeout 600000 # maximum inactivity time on the client side
srvtimeout 600000 # maximum inactivity time on the server side
timeout connect 8000 # maximum time to wait for a connection attempt to a server to succeed
stats enable
stats auth admin:password
stats uri /monitor
stats refresh 5s
option httpchk GET /status
retries 5
option redispatch
errorfile 503 /path/to/503.text.file
balance roundrobin # each server is used in turns, according to assigned weight
frontend http
bind :80
monitor-uri /haproxy # end point to monitor HAProxy status (returns 200)
acl api1 path_reg ^/api1/?
acl api2 path_reg ^/api2/?
use_backend api1 if api1
use_backend api2 if api2
### BEGIN GENERATED SECTION ###
{{range .Backends}}
backend {{.Name}}
{{range .BackendServers}} server {{.Name}} {{.Bind}} weight {{.Weight}} maxconn {{.MaxConn}} {{if .Check}}check inter {{.CheckInterval}}{{end}}{{end}}
{{if .Options.AbortOnClose}} option abortonclose
{{end}}{{if .Options.AllBackups}} option allbackups
{{end}}{{if .Options.CheckCache}} option checkcache
{{end}}{{if .Options.ForwardFor}} option forwardfor
{{end}}{{if .Options.HttpCheck}} option httpchk
{{end}}{{if .Options.HttpClose}} option httpclose
{{end}}{{if .Options.LdapCheck}} option ldap-check
{{end}}{{if .Options.MysqlCheck}} option mysql-check
{{end}}{{if .Options.PgsqlCheck}} option pgsql-check
{{end}}{{if .Options.RedisCheck}} option redis-check
{{end}}{{if .Options.SmtpCheck}} option smtpchk
{{end}}{{if .Options.SslHelloCheck}} option ssl-hello-chk
{{end}}{{if .Options.TcpKeepAlive}} option tcpka
{{end}}{{if .Options.TcpSmartAccept}} option tcp-smart-accept
{{end}}{{if .Options.TcpSmartConnect}} option tcp-smart-connect
{{end}}{{if .Options.TcpLog}} option tcplog
{{end}}{{if .Options.Transparent}} option transparent{{end}}
{{end}}
### END GENERATED SECTION ###