fast failover

This commit is contained in:
2026-02-24 13:43:56 -07:00
parent 8bb086eac9
commit 58ee1db696
9 changed files with 375 additions and 92 deletions

View File

@@ -1,6 +1,4 @@
upstream phoenix_backend {
# Hash based on WebSocket handshake key for sticky sessions
# Note: Each new connection gets a new key, so reconnections may route differently
hash $http_sec_websocket_key consistent;
server phoenix1:4000 max_fails=1 fail_timeout=10s;
@@ -22,6 +20,11 @@ server {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_next_upstream error timeout invalid_header http_502 http_503 http_504;
proxy_next_upstream_tries 1;
proxy_connect_timeout 1s;
proxy_read_timeout 60s;
}
location /api {
@@ -31,6 +34,11 @@ server {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_next_upstream error timeout invalid_header http_502 http_503 http_504;
proxy_next_upstream_tries 3;
proxy_connect_timeout 5s;
proxy_read_timeout 30s;
}
location /health {