Skip to content

Commit

Permalink
handle well-known routes by server-side
Browse files Browse the repository at this point in the history
  • Loading branch information
motoki317 committed May 8, 2024
1 parent 68c2454 commit 13c15f4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
6 changes: 1 addition & 5 deletions dev/Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,8 @@ root * /usr/share/caddy
handle /api/* {
reverse_proxy backend:3000
}

handle /.well-known/* {
respond 404
}
handle /.well-known/change-password {
redir * /settings/session
reverse_proxy backend:3000
}

handle {
Expand Down
12 changes: 9 additions & 3 deletions router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,15 @@ type Router struct {
func Setup(hub *hub.Hub, db *gorm.DB, repo repository.Repository, ss *service.Services, logger *zap.Logger, config *Config) *echo.Echo {
r := newRouter(hub, db, repo, ss, logger.Named("router"), config)

r.e.GET("/.well-known/openid-configuration", func(c echo.Context) error {
return c.Redirect(http.StatusFound, "/api/v3/oauth2/oidc/discovery")
})
wellKnown := r.e.Group("/.well-known")
{
wellKnown.GET("/reset-password", func(c echo.Context) error {
return c.Redirect(http.StatusFound, "/settings/session")
})
wellKnown.GET("/openid-configuration", func(c echo.Context) error {
return c.Redirect(http.StatusFound, "/api/v3/oauth2/oidc/discovery")
})
}

api := r.e.Group("/api")
api.GET("/metrics", echoprometheus.NewHandler())
Expand Down

0 comments on commit 13c15f4

Please sign in to comment.