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 <noreply@anthropic.com>
This commit is contained in:
@@ -456,6 +456,19 @@ func setupAdminProxy(router *echo.Echo) {
|
|||||||
adminURL = "http://127.0.0.1:3001"
|
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)
|
target, err := url.Parse(adminURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user