update for signalR
ci-cd-vm / ci-cd (push) Successful in 44s

This commit is contained in:
Chris Chen
2026-06-23 17:12:17 -07:00
parent 249ae1164d
commit a298d0ee1c
4 changed files with 104 additions and 0 deletions
+23
View File
@@ -1,3 +1,10 @@
# SignalR WebSocket upgrade helper (see /hubs/ block). Must be in http context or
# nginx fails config test: [emerg] unknown "connection_upgrade" variable.
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server { # HTTP -> HTTPS
listen 80;
server_name app.rolac.org api.rolac.org;
@@ -23,6 +30,22 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# SignalR hubs -> api container (Kestrel), same as /api/. Without this, /hubs/*
# falls through to "location /" (the static app), whose nginx 405s the negotiate
# POST so the connection never reaches the backend. Upgrade/Connection headers +
# http_version 1.1 let the WebSocket transport establish instead of long-polling.
location /hubs/ {
proxy_pass http://api:8080/hubs/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $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;
proxy_buffering off;
proxy_read_timeout 100s;
}
location / {
proxy_pass http://app:80;
}
+10
View File
@@ -1,3 +1,13 @@
# SignalR WebSocket upgrade. The /hubs/ block below sets the "Connection" header
# to this variable: "upgrade" when the client sends an Upgrade header (WebSocket),
# "close" otherwise (long-polling). nginx has no built-in $connection_upgrade, so
# it MUST be defined here in the http context or nginx fails config test on start
# ([emerg] unknown "connection_upgrade" variable) and keeps the old config.
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
server_name _;