Files
tankwar_proj/deploy/nginx-wss-snippet.conf
T
2026-05-02 13:50:52 +08:00

37 lines
1.3 KiB
Bash

#!/usr/bin/env bash
# Convenience Nginx snippet for the cluster-internal nginx (warmcheck ns).
# Drop this into warmcheck's nginx configmap under `location /games/wx/tankwar`
# once the DNS for www.igeek.site points to the 3 CVMs.
#
# Paste this whole block inside the existing `server { ... }` block that
# serves www.igeek.site with TLS.
# server { ... listen 443 ssl; server_name www.igeek.site; ... }
# Health endpoint (handy for uptime checks; optional)
location = /games/wx/tankwar/health {
proxy_pass http://tankwar-server.tankwar.svc.cluster.local:3000/health;
proxy_http_version 1.1;
}
# WebSocket endpoint that the game actually uses
location /games/wx/tankwar/ws {
proxy_pass http://tankwar-server.tankwar.svc.cluster.local:3000;
proxy_http_version 1.1;
# WebSocket upgrade
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
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-Forwarded-Proto $scheme;
# Long-lived WS — well past server HEARTBEAT_INTERVAL (10s)
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;
proxy_connect_timeout 10s;
proxy_buffering off;
}