Private
Public Access
1
0

fix: support /api/data/ path prefix as ingress workaround
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

Requests from the web frontend use /api/data/... paths but the
data-api routes are registered under /api/.... Add a Pre middleware
rewrite rule to strip the /data segment before route matching.
This commit is contained in:
2026-03-18 23:06:05 -07:00
parent 2a3429b594
commit bf27d87891

View File

@@ -187,6 +187,10 @@ func (srv *Server) Run() error {
AllowHeaders: []string{echo.HeaderOrigin, echo.HeaderContentType, echo.HeaderAccept}, AllowHeaders: []string{echo.HeaderOrigin, echo.HeaderContentType, echo.HeaderAccept},
})) }))
e.Pre(middleware.Rewrite(map[string]string{
"/api/data/*": "/api/$1",
}))
e.Use(middleware.RecoverWithConfig(middleware.RecoverConfig{ e.Use(middleware.RecoverWithConfig(middleware.RecoverConfig{
LogErrorFunc: func(c echo.Context, err error, stack []byte) error { LogErrorFunc: func(c echo.Context, err error, stack []byte) error {
log.ErrorContext(c.Request().Context(), err.Error(), "stack", string(stack)) log.ErrorContext(c.Request().Context(), err.Error(), "stack", string(stack))