forked from mtusi2026/mtusi2026lab3
Исправить readiness LB и ресурсные лимиты
This commit is contained in:
@@ -24,6 +24,8 @@ http {
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
proxy_intercept_errors on;
|
||||
error_page 502 503 504 = @no_ready_api;
|
||||
|
||||
location = /nginx-health {
|
||||
access_log off;
|
||||
@@ -31,6 +33,18 @@ http {
|
||||
return 200 '{"status":"ok"}';
|
||||
}
|
||||
|
||||
# After both peers have refused traffic or become unreachable, Nginx
|
||||
# would normally emit its own HTML 502. Keep the public API contract:
|
||||
# no ready backend is a JSON 503 with the required tracing headers.
|
||||
location @no_ready_api {
|
||||
internal;
|
||||
default_type application/json;
|
||||
add_header X-Request-Id $request_id always;
|
||||
add_header X-Instance-Id nginx always;
|
||||
add_header Cache-Control "no-store" always;
|
||||
return 503 '{"error":{"code":"unavailable","message":"No ready API backend","request_id":"$request_id"}}';
|
||||
}
|
||||
|
||||
# Message POST is the only non-idempotent HTTP method that is safe to
|
||||
# replay here: the API requires Idempotency-Key and commits the message
|
||||
# together with its shared PostgreSQL idempotency record.
|
||||
|
||||
Reference in New Issue
Block a user