Skip to content

Commit

Permalink
Adjusting reapply_cors logic to return the first match rather than th…
Browse files Browse the repository at this point in the history
…e specified origin header
  • Loading branch information
alexcottner committed Nov 21, 2024
1 parent 8e9f42d commit 77eefbb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kinto/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,9 @@ def reapply_cors(request, response):
settings = request.registry.settings
allowed_origins = set(aslist(settings["cors_origins"]))
required_origins = {"*", origin}
matches = allowed_origins.intersection(required_origins)
if allowed_origins.intersection(required_origins):
response.headers["Access-Control-Allow-Origin"] = origin
response.headers["Access-Control-Allow-Origin"] = matches.pop()

# Import service here because kinto.core import utils
from kinto.core import Service
Expand Down

0 comments on commit 77eefbb

Please sign in to comment.