From 380b3b9d1c60a903db4ccdc2ca505a38bd8e8a8f Mon Sep 17 00:00:00 2001 From: Lukasz Raczylo Date: Mon, 23 Nov 2026 00:32:47 +0000 Subject: [PATCH] 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. --- Dockerfile.frontend | 35 ++++++----------------------------- 1 file changed, 6 insertions(+), 29 deletions(-) diff --git a/Dockerfile.frontend b/Dockerfile.frontend index 5baba86..9038b18 100644 --- a/Dockerfile.frontend +++ b/Dockerfile.frontend @@ -106,38 +106,15 @@ server { access_log off; } - # Metrics endpoint - location /metrics { - proxy_pass http://backend/metrics; - proxy_http_version 1.1; - 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; + # The package endpoints are not part of the dashboard and stay on the + # backend Service. A catch-all 404 keeps them off the SPA fallback below. + location ~ ^/(npm|pypi|go|metrics)(/|$) { + return 404; } # WebSocket support - location /ws/ { - proxy_pass http://backend/ws/; + location /ws { + proxy_pass http://backend; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade";