samvera / serverless-iiif

IIIF Image API 2.1 & 3.0 server in an AWS Serverless Application
https://samvera.github.io/serverless-iiif/
Apache License 2.0
69 stars 21 forks source link

Match `Access-Control-Allow-Origin` to incoming `Origin` #104

Closed mbklein closed 1 year ago

mbklein commented 1 year ago

When doing an XmlHttpRequest preflight check with credentials: true, browsers won't accept Access-Control-Allow-Origin: * as a passing response. It requires the value of the response header to explicitly include the value provided in the Origin request header.

It's easy enough to automatically copy the request's Origin to the response's Access-Control-Allow-Origin, but we should consider (and document) the security implications, and possibly making it an opt-in configuration option.

Related issue: #103