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:
Pouzor
2026-03-18 00:16:42 +01:00
parent df3b7a8cb0
commit e5d7260696
6 changed files with 69 additions and 6 deletions
+11 -1
View File
@@ -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;