fix: harden rewrite websocket configurations for all services
All checks were successful
ci / treefmt (push) Successful in 1m37s

This commit is contained in:
Ceferino Patino 2026-06-28 14:27:45 -05:00
commit ea516b3f32
Signed by: c4patino
SSH key fingerprint: SHA256:Wu+cU1t+7zVT9wzew/4meNmeulo66NzMqc22MdDBgXI
2 changed files with 4 additions and 3 deletions

View file

@ -27,7 +27,7 @@ in {
websocket = mkOpt (submodule {
options = {
enable = mkBoolOpt false "Whether to enable websocket endpoints for the service.";
path = mkOpt str "/ws/" "WebSocket path prefix for the service.";
path = mkOpt str "/ws" "WebSocket path prefix for the service.";
};
}) {} "WebSocket configuration for the service.";
};

View file

@ -72,8 +72,9 @@
websocketConfig = optionalString service.websocket.enable ''
# --- ${name} (websocket access) ---
ProxyPass ${service.websocket.path} ws://${hostIP}:${p}${service.websocket.path} connectiontimeout=30 timeout=300 retry=0
ProxyPassReverse ${service.websocket.path} ws://${hostIP}:${p}${service.websocket.path}
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteRule ^/(.*)$ ws://${hostIP}:${p}${service.websocket.path}/$1 [P,L]
'';
in {