diff --git a/handlers/api.go b/handlers/api.go index eb16820..0721b11 100644 --- a/handlers/api.go +++ b/handlers/api.go @@ -69,6 +69,8 @@ const ( ContextKeyRequestID ContextKey = "requestID" docsPrefix = "/docs" + + accessControlAllowOriginHeader = "Access-Control-Allow-Origin" ) // New creates a new API using specified logger, connection pool and other parameters. @@ -165,6 +167,8 @@ func (a *API) setupGlobalMiddleware(handler http.Handler) http.Handler { ctx := context.WithValue(r.Context(), ContextKeyRequestID, requestID) + w.Header().Set(accessControlAllowOriginHeader, allOrigins) + handler.ServeHTTP(w, r.WithContext(ctx)) }) }