Skip to content

Conversation

TC-AVNP
Copy link

@TC-AVNP TC-AVNP commented Oct 24, 2022

Prevents having an Allowed list with repeated values to iterate over.

Example:
When configuring "Origin" as an Allowed header, the list would be comprised of: []string{"Origin","Origin"}, lead to an unnecessary additional loop.

@evanj
Copy link

evanj commented Apr 10, 2023

I believe this will fix problems when there may be proxied requests, which can cause an HTTP response with multiple headers, which Chrome rejects with:

Access to XMLHttpRequest at 'http://localhost:...' from origin '...' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains multiple values '*, *', but only one is allowed.

This can be worked around in the application code by stripping headers, but it seems to me that this middleware should replace headers itself, rather than adding to them.

@evanj
Copy link

evanj commented Apr 10, 2023

Oops sorry so, I misunderstood this PR, never mind!

@jub0bs
Copy link
Contributor

jub0bs commented Apr 24, 2024

@rs Now that #171 has been merged, you can close this PR.

@rs rs closed this Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants