From 1fdc29af1cffbe6c7fc9d2bc3273ee8d6565d5a1 Mon Sep 17 00:00:00 2001 From: Trey t Date: Sat, 7 Mar 2026 12:25:26 -0600 Subject: [PATCH] Add admin subdomain redirect for admin.myhoneydue.com When ADMIN_HOST is set, redirects root "/" to "/admin/" so admin.myhoneydue.com works without needing the /admin path suffix. Co-Authored-By: Claude Opus 4.6 --- internal/admin/routes.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/internal/admin/routes.go b/internal/admin/routes.go index c240965..b7f5c06 100644 --- a/internal/admin/routes.go +++ b/internal/admin/routes.go @@ -456,6 +456,19 @@ func setupAdminProxy(router *echo.Echo) { adminURL = "http://127.0.0.1:3001" } + // Admin subdomain (e.g. admin.myhoneydue.com) — redirect root to /admin/ + adminHost := os.Getenv("ADMIN_HOST") + if adminHost != "" { + router.Use(func(next echo.HandlerFunc) echo.HandlerFunc { + return func(c echo.Context) error { + if c.Request().Host == adminHost && c.Request().URL.Path == "/" { + return c.Redirect(http.StatusMovedPermanently, "/admin/") + } + return next(c) + } + }) + } + target, err := url.Parse(adminURL) if err != nil { return