Skip to content

Commit

Permalink
fix: cors headers not added to the response #2922 (#2934)
Browse files Browse the repository at this point in the history
  • Loading branch information
kstasik committed Dec 7, 2022
1 parent b3b6f88 commit 1ed6839
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cmd/daemon/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,14 @@ func ServePublic(r driver.Registry, cmd *cobra.Command, args []string, slOpts *s
r.RegisterPublicRoutes(ctx, router)
r.PrometheusManager().RegisterRouter(router.Router)

if options, enabled := r.Config().CORS(ctx, "public"); enabled {
n.UseFunc(cors.New(options).ServeHTTP)
var handler http.Handler = n
options, enabled := r.Config().CORS(ctx, "public")
if enabled {
handler = cors.New(options).Handler(handler)
}

certs := c.GetTLSCertificatesForPublic(ctx)

var handler http.Handler = n
if tracer := r.Tracer(ctx); tracer.IsLoaded() {
handler = otelx.TraceHandler(handler, otelhttp.WithTracerProvider(tracer.Provider()))
}
Expand Down

0 comments on commit 1ed6839

Please sign in to comment.