forked from mtusi2026/mtusi2026lab3
add fix
This commit is contained in:
+7
-2
@@ -4,8 +4,9 @@ events {
|
||||
|
||||
http {
|
||||
upstream api_cluster {
|
||||
# Балансировка Round-Robin между репликами Compose
|
||||
server api:8000 max_fails=2 fail_timeout=5s;
|
||||
# УЛУЧШЕНИЕ: пул постоянных Keep-Alive соединений к репликам
|
||||
keepalive 64;
|
||||
}
|
||||
|
||||
server {
|
||||
@@ -13,12 +14,16 @@ http {
|
||||
|
||||
location / {
|
||||
proxy_pass http://api_cluster;
|
||||
|
||||
# УЛУЧШЕНИЕ: использование HTTP/1.1 и переиспользование сокетов
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "";
|
||||
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Request-Id $http_x_request_id;
|
||||
|
||||
# Мгновенное переключение при падении одной из реплик (Failover)
|
||||
proxy_next_upstream error timeout http_502 http_503 http_504 non_idempotent;
|
||||
proxy_next_upstream_timeout 10s;
|
||||
proxy_next_upstream_tries 3;
|
||||
|
||||
Reference in New Issue
Block a user