Skip to content

Conversation

bugdea1er
Copy link
Contributor

CORS disallows setting allowed origin to '*' when credentials are allowed

This pull request sets allowed origin to client origin when credentials are allowed

More info here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSNotSupportingCredentials

@gittiver
Copy link
Member

gittiver commented Jan 8, 2025

There is a unit test failing:

(2025-01-08 22:27:35) [DEBUG ] 0x11e81b818 from read(1) with description: "stream ended at an unexpected time"

unittest is a Catch2 v3.7.0 host application.
Run with -? for options

-------------------------------------------------------------------------------
middleware_cors_origin
-------------------------------------------------------------------------------
/Users/runner/work/Crow/Crow/tests/unittest.cpp:1994
...............................................................................

/Users/runner/work/Crow/Crow/tests/unittest.cpp:2016: FAILED:
  CHECK( resp.find("Access-Control-Allow-Origin: test-client") != std::string::npos )
(2025-01-08 22:27:35) [DEBUG   ] 0x11e81b818 from write(2)
with expansion:
(2025-01-08 22:27:35) [DEBUG   ] Connection (0x11e81b818) freed, total: 1
  18446744073709551615 (0xffffffffffffffff)
  !=
  18446744073709551615 (0xffffffffffffffff)

@gittiver gittiver merged commit c27c5ce into CrowCpp:master Jan 9, 2025
11 checks passed
@bugdea1er bugdea1er deleted the cors-origin branch January 9, 2025 16:00
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.

2 participants