From 15f17b678155c30715d78c531076bc3ba848ea87 Mon Sep 17 00:00:00 2001 From: kwilt Date: Sat, 11 Jan 2025 15:21:26 -0600 Subject: [PATCH] 404 anything that doesn't match routePrefix Signed-off-by: kwilt --- web/landing_page.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/web/landing_page.go b/web/landing_page.go index d5c6b624..06a4c28e 100644 --- a/web/landing_page.go +++ b/web/landing_page.go @@ -64,6 +64,7 @@ type LandingLinks struct { type LandingPageHandler struct { landingPage []byte + routePrefix string } var ( @@ -111,10 +112,15 @@ func NewLandingPage(c LandingConfig) (*LandingPageHandler, error) { return &LandingPageHandler{ landingPage: buf.Bytes(), + routePrefix: c.RoutePrefix, }, nil } func (h *LandingPageHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { + if r.URL.Path != h.routePrefix { + http.NotFound(w, r) + return + } w.Header().Add("Content-Type", "text/html; charset=UTF-8") w.Write(h.landingPage) }