From da2d72e95d908eadfad36e7e946059bc346cf52f Mon Sep 17 00:00:00 2001 From: josh Date: Sat, 9 May 2026 20:54:15 -0400 Subject: [PATCH] Fix static file serving by using fs.Sub on embed FS The //go:embed static directive nests files under static/, so after StripPrefix removes /static/ from the URL, the FileServer couldn't find the files. Use fs.Sub to root the FS at the static/ subdirectory. Co-Authored-By: Claude Opus 4.6 --- internal/httpserver/router.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/httpserver/router.go b/internal/httpserver/router.go index af31fef..9b658f1 100644 --- a/internal/httpserver/router.go +++ b/internal/httpserver/router.go @@ -1,6 +1,7 @@ package httpserver import ( + "io/fs" "net/http" "provisioning/internal/api" @@ -25,7 +26,8 @@ func NewRouter(d Deps) http.Handler { r.Use(middleware.Logger) // Static files - r.Handle("/static/*", http.StripPrefix("/static/", http.FileServer(http.FS(web.Static)))) + staticFS, _ := fs.Sub(web.Static, "static") + r.Handle("/static/*", http.StripPrefix("/static/", http.FileServer(http.FS(staticFS)))) // SSE r.Get("/events", d.Hub.ServeSSE)