fix(frontend): keep package endpoints off the dashboard proxy

The dashboard image forwarded /npm, /pypi, /go and /metrics to the
backend, so exposing the dashboard also exposed the package cache. Those
paths now return 404. The WebSocket location also matches /ws, the path
the backend serves.
This commit is contained in:
2026-11-23 00:32:47 +00:00
parent a313ac1096
commit 380b3b9d1c
+6 -29
View File
@@ -106,38 +106,15 @@ server {
access_log off; access_log off;
} }
# Metrics endpoint # The package endpoints are not part of the dashboard and stay on the
location /metrics { # backend Service. A catch-all 404 keeps them off the SPA fallback below.
proxy_pass http://backend/metrics; location ~ ^/(npm|pypi|go|metrics)(/|$) {
proxy_http_version 1.1; return 404;
proxy_set_header Connection "";
}
# Package download endpoints
location ~ ^/(npm|pypi|go)/ {
proxy_pass http://backend;
proxy_http_version 1.1;
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_set_header Connection "";
# Extended timeouts for package downloads
proxy_connect_timeout 60s;
proxy_send_timeout 600s;
proxy_read_timeout 600s;
# Large buffer for package downloads
proxy_buffering on;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
} }
# WebSocket support # WebSocket support
location /ws/ { location /ws {
proxy_pass http://backend/ws/; proxy_pass http://backend;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade"; proxy_set_header Connection "upgrade";