39 lines
1.2 KiB
Plaintext
39 lines
1.2 KiB
Plaintext
worker_processes auto;
|
|
events { worker_connections 2048; }
|
|
http {
|
|
resolver 127.0.0.11 valid=10s ipv6=off;
|
|
map $http_upgrade $connection_upgrade {
|
|
default upgrade;
|
|
'' '';
|
|
}
|
|
upstream api {
|
|
zone api 64k;
|
|
# Keep Socket.IO HTTP polling on the same replica. Redis shares room events.
|
|
ip_hash;
|
|
server api-a:4000 resolve max_fails=3 fail_timeout=10s;
|
|
server api-b:4000 resolve max_fails=3 fail_timeout=10s;
|
|
server api-c:4000 resolve max_fails=3 fail_timeout=10s;
|
|
keepalive 32;
|
|
}
|
|
server {
|
|
listen 8080;
|
|
client_max_body_size 128m;
|
|
location / {
|
|
proxy_pass http://api;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
# Replace client-supplied forwarding headers at this trusted boundary.
|
|
proxy_set_header X-Forwarded-For $remote_addr;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
proxy_connect_timeout 3s;
|
|
proxy_read_timeout 240s;
|
|
proxy_send_timeout 240s;
|
|
proxy_next_upstream error timeout http_502 http_503 http_504;
|
|
# Never enable non_idempotent retries: writes must not be replayed.
|
|
}
|
|
}
|
|
}
|