fix: resolve WebSocket failure and crypto.randomUUID crash on HTTP/LXC
- Replace crypto.randomUUID() with a polyfill (generateUUID) that falls back to crypto.getRandomValues or Math.random — fixes crash on HTTP non-secure contexts where randomUUID is unavailable - Fix WebSocket URL hardcoding port 8000 — use window.location.host so connections go through Nginx proxy in Docker/LXC instead of bypassing it - Add /api/v1/status/ws/ location block in nginx.conf with WebSocket upgrade headers (must precede /api/ to avoid missing Upgrade header)
This commit is contained in:
+11
-1
@@ -4,6 +4,16 @@ server {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# Proxy WebSocket (must be before /api/ to take priority)
|
||||
location /api/v1/status/ws/ {
|
||||
proxy_pass http://backend:8000;
|
||||
proxy_http_version 1.1;
|
||||
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 API to backend
|
||||
location /api/ {
|
||||
proxy_pass http://backend:8000;
|
||||
@@ -11,7 +21,7 @@ server {
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
}
|
||||
|
||||
# Proxy WebSocket
|
||||
# Proxy legacy /ws/ path
|
||||
location /ws/ {
|
||||
proxy_pass http://backend:8000;
|
||||
proxy_http_version 1.1;
|
||||
|
||||
Reference in New Issue
Block a user