fix: 重启更新

This commit is contained in:
DDSRem
2023-09-08 20:33:23 +08:00
parent 55dce26cb8
commit c8bc6a4618
5 changed files with 27 additions and 17 deletions

View File

@ -12,6 +12,11 @@ global
# Turn on stats unix socket
server-state-file /var/lib/haproxy/server-state
setenv POST 1
setenv ALLOW_RESTARTS 1
setenv CONTAINERS 1
setenv VERSION 1
defaults
mode http
log global
@ -46,7 +51,10 @@ backend dockerbackend
frontend dockerfrontend
bind :2375
http-request allow
http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/containers/[a-zA-Z0-9_.-]+/((stop)|(restart)|(kill)) }
http-request deny unless METH_GET || { env(POST) -m bool }
http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/containers/[a-zA-Z0-9_.-]+/((stop)|(restart)|(kill)) } { env(ALLOW_RESTARTS) -m bool }
http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/containers } { env(CONTAINERS) -m bool }
http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/version } { env(VERSION) -m bool }
http-request deny
default_backend dockerbackend
default_backend dockerbackend