pact-foundation / pact-reference

Reference implementations for the pact specifications
https://pact.io
MIT License
91 stars 46 forks source link

fix(cors): source allowed origin from origin header, add credentials #225

Closed mefellows closed 1 year ago

mefellows commented 1 year ago

The access-control-allow-origin value was being sourced from the referrer, which resulted in a trailing / and caused CORS pre-flight requests to fail.

This change sources the allowed origin from origin header, ensures it's the same for cors responses pre and post the pre-flight request, and adds the access-control-allow-credentials header.

See also https://github.com/pact-foundation/pact-js/issues/943.