forked from mtusi2026/mtusi2026lab5
67 lines
2.0 KiB
INI
67 lines
2.0 KiB
INI
global
|
|
log stdout format raw local0
|
|
maxconn 2048
|
|
|
|
defaults
|
|
log global
|
|
mode http
|
|
option httplog
|
|
timeout connect 1s
|
|
timeout client 30s
|
|
timeout server 30s
|
|
|
|
resolvers docker
|
|
nameserver dns 127.0.0.11:53
|
|
resolve_retries 3
|
|
timeout resolve 1s
|
|
timeout retry 1s
|
|
hold valid 1s
|
|
hold other 1s
|
|
hold refused 1s
|
|
hold nx 1s
|
|
hold timeout 1s
|
|
hold obsolete 1s
|
|
|
|
frontend public
|
|
bind :8080
|
|
|
|
acl api_request path_beg /api/ /web-api/ /health/
|
|
acl web_api path_beg /web-api/
|
|
acl has_session req.cook(mtusi_session) -m found
|
|
acl message_create method POST
|
|
acl message_path path_reg ^/(api|web-api)/v1/chats/[^/]+/messages$
|
|
|
|
http-request del-header Authorization if web_api
|
|
http-request set-header Authorization "Bearer %[req.cook(mtusi_session)]" if web_api has_session
|
|
http-request del-header Cookie if api_request
|
|
http-request replace-path ^/web-api/(.*)$ /api/\1 if web_api
|
|
|
|
use_backend message_backend if message_create message_path
|
|
use_backend api_backend if api_request
|
|
default_backend frontend_backend
|
|
|
|
backend api_backend
|
|
balance leastconn
|
|
option httpchk
|
|
http-check send meth GET uri /health/lb ver HTTP/1.1 hdr Host api
|
|
http-check expect status 200
|
|
default-server check inter 1s fastinter 500ms downinter 1s fall 2 rise 2 resolvers docker init-addr libc,none
|
|
server-template api 8 api:8080
|
|
|
|
backend message_backend
|
|
balance leastconn
|
|
option httpchk
|
|
option redispatch
|
|
option http-buffer-request
|
|
retries 3
|
|
retry-on conn-failure empty-response response-timeout 502 503 504
|
|
http-check send meth GET uri /health/lb ver HTTP/1.1 hdr Host api
|
|
http-check expect status 200
|
|
default-server check inter 1s fastinter 500ms downinter 1s fall 2 rise 2 resolvers docker init-addr libc,none
|
|
server-template api 8 api:8080
|
|
|
|
backend frontend_backend
|
|
option httpchk GET /
|
|
http-check expect status 200
|
|
server frontend frontend:8080 check inter 2s fall 2 rise 2 resolvers docker init-addr libc,none
|