fix: support /api/data/ path prefix as ingress workaround
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
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:
@@ -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))
|
||||||
|
|||||||
Reference in New Issue
Block a user