Repository navigation
Expand file tree
/
Copy pathhaproxy.cfg
More file actions
75 lines (64 loc) · 3.6 KB
/
Copy pathhaproxy.cfg
File metadata and controls
75 lines (64 loc) · 3.6 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
global
log stdout format raw daemon "$LOG_LEVEL"
maxconn 2000
defaults
mode http
log global
option httplog
option dontlognull
option http-server-close
retries 0
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 10m
timeout server 10m
timeout tunnel 24h
timeout http-keep-alive 10s
timeout check 10s
maxconn 2000
backend docker
acl read_stream method GET
acl events_stream path,url_dec -m reg ^(/v[0-9.]+)?/events$
acl logs_stream path,url_dec -m reg ^(/v[0-9.]+)?/containers/[A-Za-z0-9_.-]+/logs$
acl follow_logs url_param(follow) -m str true 1
http-request set-timeout server 24h if read_stream events_stream
http-request set-timeout server 24h if read_stream logs_stream follow_logs
server socket "$SOCKET_PATH"
frontend proxy
.if streq("$DISABLE_IPV6",1)
.notice "Proxy on port 2375 (IPv4 only)"
bind :2375
.else
.notice "Proxy on port 2375"
bind [::]:2375 v4v6
.endif
http-request allow if METH_POST { path,url_dec -m reg ^(/v[0-9.]+)?/containers/[A-Za-z0-9_.-]+/(stop|restart|kill)$ } { env(ALLOW_RESTARTS) -m bool }
http-request allow if METH_POST { path,url_dec -m reg ^(/v[0-9.]+)?/containers/[A-Za-z0-9_.-]+/start$ } { env(ALLOW_START) -m bool }
http-request allow if METH_POST { path,url_dec -m reg ^(/v[0-9.]+)?/containers/[A-Za-z0-9_.-]+/stop$ } { env(ALLOW_STOP) -m bool }
http-request deny unless METH_GET || { env(POST) -m bool }
http-request allow if { path,url_dec -m reg ^(/v[0-9.]+)?/auth$ } { env(AUTH) -m bool }
http-request allow if { path,url_dec -m reg ^(/v[0-9.]+)?/build(/|$) } { env(BUILD) -m bool }
http-request allow if { path,url_dec -m reg ^(/v[0-9.]+)?/commit$ } { env(COMMIT) -m bool }
http-request allow if { path,url_dec -m reg ^(/v[0-9.]+)?/configs(/|$) } { env(CONFIGS) -m bool }
http-request allow if { path,url_dec -m reg ^(/v[0-9.]+)?/containers(/|$) } { env(CONTAINERS) -m bool }
http-request allow if { path,url_dec -m reg ^(/v[0-9.]+)?/distribution(/|$) } { env(DISTRIBUTION) -m bool }
http-request allow if { path,url_dec -m reg ^(/v[0-9.]+)?/events$ } { env(EVENTS) -m bool }
http-request allow if { path,url_dec -m reg ^(/v[0-9.]+)?/exec(/|$) } { env(EXEC) -m bool }
http-request allow if { path,url_dec -m reg ^(/v[0-9.]+)?/grpc(/|$) } { env(GRPC) -m bool }
http-request allow if { path,url_dec -m reg ^(/v[0-9.]+)?/images(/|$) } { env(IMAGES) -m bool }
http-request allow if { path,url_dec -m reg ^(/v[0-9.]+)?/info$ } { env(INFO) -m bool }
http-request allow if { path,url_dec -m reg ^(/v[0-9.]+)?/networks(/|$) } { env(NETWORKS) -m bool }
http-request allow if { path,url_dec -m reg ^(/v[0-9.]+)?/nodes(/|$) } { env(NODES) -m bool }
http-request allow if { path,url_dec -m reg ^(/v[0-9.]+)?/_ping$ } { env(PING) -m bool }
http-request allow if { path,url_dec -m reg ^(/v[0-9.]+)?/plugins(/|$) } { env(PLUGINS) -m bool }
http-request allow if { path,url_dec -m reg ^(/v[0-9.]+)?/secrets(/|$) } { env(SECRETS) -m bool }
http-request allow if { path,url_dec -m reg ^(/v[0-9.]+)?/services(/|$) } { env(SERVICES) -m bool }
http-request allow if { path,url_dec -m reg ^(/v[0-9.]+)?/session(/|$) } { env(SESSION) -m bool }
http-request allow if { path,url_dec -m reg ^(/v[0-9.]+)?/swarm(/|$) } { env(SWARM) -m bool }
http-request allow if { path,url_dec -m reg ^(/v[0-9.]+)?/system(/|$) } { env(SYSTEM) -m bool }
http-request allow if { path,url_dec -m reg ^(/v[0-9.]+)?/tasks(/|$) } { env(TASKS) -m bool }
http-request allow if { path,url_dec -m reg ^(/v[0-9.]+)?/version$ } { env(VERSION) -m bool }
http-request allow if { path,url_dec -m reg ^(/v[0-9.]+)?/volumes(/|$) } { env(VOLUMES) -m bool }
http-request deny
default_backend docker