fix(router): correct cors setup for session routes

This commit is contained in:
Trong Huu Nguyen
2023-08-22 07:44:35 +02:00
parent 7ffe291ebe
commit 7029bd1210

View File

@@ -90,11 +90,12 @@ func New(src Source, cfg *config.Config) chi.Router {
r.Route(paths.Session, func(r chi.Router) {
if cfg.SSO.IsServer() {
r.With(cors(http.MethodGet)).
Options("/", noopHandler)
r.With(cors(http.MethodGet, http.MethodPost)).
Options(paths.Refresh, noopHandler)
r.Use(cors(http.MethodGet, http.MethodPost))
r.Options("/", noopHandler)
r.Options(paths.Refresh, noopHandler)
}
r.Get("/", src.Session)
r.Get(paths.Refresh, src.SessionRefresh)
r.Post(paths.Refresh, src.SessionRefresh)