This commit is contained in:
2026-11-10 19:24:33 +03:00
parent c594b88a46
commit b55b230533
23 changed files with 1200 additions and 73 deletions
+7 -2
View File
@@ -36,7 +36,8 @@ defaults
timeout connect 1s
timeout client 30s
timeout server 10s
timeout http-request 10s
# Body arrival for a 10 MiB attachment; JSON posts finish well under this.
timeout http-request 30s
timeout http-keep-alive 5s
timeout queue 2s
timeout check 1s
@@ -55,7 +56,7 @@ frontend public
acl safe_request_id req.hdr(X-Request-Id) -m reg ^[A-Za-z0-9._:-]{1,128}$
http-request set-var(txn.reqid) req.hdr(X-Request-Id) if upload_too_large safe_request_id
http-request set-var(txn.reqid) str(lb) if upload_too_large !safe_request_id
http-request return status 413 content-type application/json lf-string "{\"error\":{\"code\":\"payload_too_large\",\"message\":\"Файл больше 10 МиБ\",\"request_id\":\"%[var(txn.reqid)]\"}}" hdr X-Request-Id %[var(txn.reqid)] if upload_too_large
http-request return status 413 content-type application/json lf-string "{\"error\":{\"code\":\"payload_too_large\",\"message\":\"Файл больше 10 МиБ\",\"request_id\":\"%[var(txn.reqid)]\"}}" hdr X-Request-Id %[var(txn.reqid)] hdr X-Instance-Id %[str(lb)] if upload_too_large
# Message POST carries a mandatory Idempotency-Key, so replaying it on another replica is safe.
# Other POSTs (users, chats, sessions) are retried only when the connection was never established.
@@ -67,6 +68,10 @@ frontend public
backend api
# Round robin, no stickiness: any replica serves any session from PostgreSQL.
# Attachment PUT to S3 can outlast the default 10 s server timeout under concurrent load.
acl attachment_upload method POST
acl attachment_upload_path path_reg ^/api/v1/chats/[^/]+/attachments$
http-request set-timeout server 30s if attachment_upload attachment_upload_path
balance roundrobin
option httpchk
http-check send meth GET uri /health/ready ver HTTP/1.1 hdr Host lb