From 85003cd4372475b9cae973b74261a6ca3f61af0d Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Mon, 16 Mar 2026 20:57:00 +0000 Subject: fix: serve sw.js from /api/push/sw.js to bypass Apache static file routing Apache fronts the Go service and only proxies /api/ paths; /sw.js hits Apache's filesystem and 404s. Serve the service worker from /api/push/sw.js with Service-Worker-Allowed: / so the browser allows it to control the full origin scope. Update SW registration URL. Co-Authored-By: Claude Sonnet 4.6 --- internal/api/server.go | 1 + 1 file changed, 1 insertion(+) (limited to 'internal/api/server.go') diff --git a/internal/api/server.go b/internal/api/server.go index 488c500..f640aba 100644 --- a/internal/api/server.go +++ b/internal/api/server.go @@ -134,6 +134,7 @@ func (s *Server) routes() { s.mux.HandleFunc("GET /api/health", s.handleHealth) s.mux.HandleFunc("POST /api/webhooks/github", s.handleGitHubWebhook) s.mux.HandleFunc("GET /api/push/vapid-key", s.handleGetVAPIDKey) + s.mux.HandleFunc("GET /api/push/sw.js", s.handleServiceWorker) s.mux.HandleFunc("POST /api/push/subscribe", s.handlePushSubscribe) s.mux.HandleFunc("DELETE /api/push/subscribe", s.handlePushUnsubscribe) s.mux.HandleFunc("GET /api/drops", s.handleListDrops) -- cgit v1.2.3