fix: add authorization to cors

This commit is contained in:
Livio Amstutz 2020-08-24 16:06:49 +02:00
parent 6e71c17f1d
commit d053d8ae48

View file

@ -44,7 +44,11 @@ func CreateRouter(o OpenIDProvider, h HttpInterceptor) *mux.Router {
h = DefaultInterceptor
}
router := mux.NewRouter()
router.Use(handlers.CORS(handlers.AllowedOriginValidator(allowAllOrigins), handlers.AllowedHeaders([]string{"content-type"})))
router.Use(handlers.CORS(
handlers.AllowCredentials(),
handlers.AllowedHeaders([]string{"authorization", "content-type"}),
handlers.AllowedOriginValidator(allowAllOrigins),
))
router.HandleFunc(healthzEndpoint, Healthz)
router.HandleFunc(readinessEndpoint, o.HandleReady)
router.HandleFunc(oidc.DiscoveryEndpoint, o.HandleDiscovery)