|
|
|
|
@ -294,8 +294,14 @@ func newServer(ctx context.Context, c Config, rotationStrategy rotationStrategy)
|
|
|
|
|
handleWithCORS := func(p string, h http.HandlerFunc) { |
|
|
|
|
var handler http.Handler = h |
|
|
|
|
if len(c.AllowedOrigins) > 0 { |
|
|
|
|
corsOption := handlers.AllowedOrigins(c.AllowedOrigins) |
|
|
|
|
handler = handlers.CORS(corsOption)(handler) |
|
|
|
|
allowedHeaders := []string{ |
|
|
|
|
"Authorization", |
|
|
|
|
} |
|
|
|
|
cors := handlers.CORS( |
|
|
|
|
handlers.AllowedOrigins(c.AllowedOrigins), |
|
|
|
|
handlers.AllowedHeaders(allowedHeaders), |
|
|
|
|
) |
|
|
|
|
handler = cors(handler) |
|
|
|
|
} |
|
|
|
|
r.Handle(path.Join(issuerURL.Path, p), instrumentHandlerCounter(p, handler)) |
|
|
|
|
} |
|
|
|
|
|