lab3: 2 API replicas behind nginx LB, idempotency, X-Instance-Id

This commit is contained in:
2026-11-16 21:54:29 +03:00
parent 0ab3a341aa
commit fbe686f521
23 changed files with 727 additions and 14 deletions
+24
View File
@@ -0,0 +1,24 @@
worker_processes 1;
events { worker_connections 1024; }
http {
upstream api {
server api-1:8080 max_fails=1 fail_timeout=2s;
server api-2:8080 max_fails=1 fail_timeout=2s;
}
server {
listen 8080;
location / {
proxy_pass http://api;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_next_upstream error timeout http_502 http_503 http_504;
proxy_connect_timeout 1s;
proxy_read_timeout 5s;
}
}
}