docker-socket-proxy/haproxy.cfg
2018-02-17 18:23:19 +01:00

65 lines
2.9 KiB
INI

global
log /dev/log local0
pidfile /run/haproxy.pid
maxconn 4000
# Turn on stats unix socket
server-state-file /var/lib/haproxy/server-state
defaults
mode http
log global
option httplog
option dontlognull
option http-server-close
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 10m
timeout server 10m
timeout http-keep-alive 10s
timeout check 10s
maxconn 3000
# Allow seamless reloads
load-server-state-from-file global
backend dockerbackend
http-request deny unless METH_GET || { env(POST) -m bool }
http-request deny if { path,url_dec -m reg -i ^(/v[\d\.]+)?/auth } ! { env(AUTH) -m bool }
http-request deny if { path,url_dec -m reg -i ^(/v[\d\.]+)?/build } ! { env(BUILD) -m bool }
http-request deny if { path,url_dec -m reg -i ^(/v[\d\.]+)?/commit } ! { env(COMMIT) -m bool }
http-request deny if { path,url_dec -m reg -i ^(/v[\d\.]+)?/containers } ! { env(CONTAINERS) -m bool }
http-request deny if { path,url_dec -m reg -i ^(/v[\d\.]+)?/events } ! { env(EVENTS) -m bool }
http-request deny if { path,url_dec -m reg -i ^(/v[\d\.]+)?/exec } ! { env(EXEC) -m bool }
http-request deny if { path,url_dec -m reg -i ^(/v[\d\.]+)?/images } ! { env(IMAGES) -m bool }
http-request deny if { path,url_dec -m reg -i ^(/v[\d\.]+)?/info } ! { env(INFO) -m bool }
http-request deny if { path,url_dec -m reg -i ^(/v[\d\.]+)?/networks } ! { env(NETWORKS) -m bool }
http-request deny if { path,url_dec -m reg -i ^(/v[\d\.]+)?/nodes } ! { env(NODES) -m bool }
http-request deny if { path,url_dec -m reg -i ^(/v[\d\.]+)?/_ping } ! { env(PING) -m bool }
http-request deny if { path,url_dec -m reg -i ^(/v[\d\.]+)?/plugins } ! { env(PLUGINS) -m bool }
http-request deny if { path,url_dec -m reg -i ^(/v[\d\.]+)?/post } ! { env(POST) -m bool }
http-request deny if { path,url_dec -m reg -i ^(/v[\d\.]+)?/secrets } ! { env(SECRETS) -m bool }
http-request deny if { path,url_dec -m reg -i ^(/v[\d\.]+)?/services } ! { env(SERVICES) -m bool }
http-request deny if { path,url_dec -m reg -i ^(/v[\d\.]+)?/swarm } ! { env(SWARM) -m bool }
http-request deny if { path,url_dec -m reg -i ^(/v[\d\.]+)?/system } ! { env(SYSTEM) -m bool }
http-request deny if { path,url_dec -m reg -i ^(/v[\d\.]+)?/tasks } ! { env(TASKS) -m bool }
http-request deny if { path,url_dec -m reg -i ^(/v[\d\.]+)?/version } ! { env(VERSION) -m bool }
http-request deny if { path,url_dec -m reg -i ^(/v[\d\.]+)?/volumes } ! { env(VOLUMES) -m bool }
server dockersocket /var/run/docker.sock
frontend docker-network
bind :2375
http-request deny if ! { env(SOCK_NETWORK) -m bool }
default_backend dockerbackend
frontend docker-disk
bind /run/docker-filtered/docker.sock
http-request deny if ! { env(SOCK_DISK) -m bool }
default_backend dockerbackend