diff --git a/server.go b/server.go index b658279..08e7256 100644 --- a/server.go +++ b/server.go @@ -10,6 +10,7 @@ import ( "github.com/labstack/echo/v4/middleware" "github.com/rs/zerolog/log" "net/http" + "regexp" ) func NewServer(conf *koanf.Koanf, pool *pgxpool.Pool) *echo.Echo { @@ -30,7 +31,9 @@ func addMiddleware(s *echo.Echo, conf *koanf.Koanf) { s.Use(middleware.JWTWithConfig(middleware.JWTConfig{ Skipper: func(ctx echo.Context) bool { - return ctx.Request().Method == "GET" && ctx.Request().URL.Path != "/links" + matchesLinks, _ := regexp.MatchString("^/links", ctx.Request().URL.Path) + + return ctx.Request().Method == "GET" && !matchesLinks }, SigningMethod: conf.String("jwt.method"), SigningKey: conf.Bytes("jwt.key"),