This repository was archived by the owner on Sep 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhaproxy.tmpl
More file actions
57 lines (47 loc) · 1.22 KB
/
haproxy.tmpl
File metadata and controls
57 lines (47 loc) · 1.22 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
51
52
53
54
55
56
57
#
# Configuration file generated by docker-api-gateway at
# {{ .Time }}
#
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
defaults
log global
mode http
option httplog
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000
##
## Front-end will listen on *:80 and route to each container
##
frontend api.example.com
bind *:80
{{range .Guests }}
acl {{.FriendlyName}} path_beg /{{.Name}}
use_backend {{.FriendlyName}}-backend if {{.FriendlyName}}
{{end}}
# Catches anything not covered by use_backend above
default_backend no-match
backend no-match
http-request deny deny_status 403
##
## Now begins the backends for each running container.
##
{{range .Guests }}
#
# {{.Name}} running on {{.IP}}:8000
# Container ID {{.ID}}
#
backend {{.FriendlyName}}-backend
reqrep ^(GET|HEAD|POST)\ /{{.Name}}(.*) \1\ /\2
server name {{.IP}}:8000 check inter 2000
server name {{.IP}}:80 check inter 2000
{{end}}