Fix CORS response headers.

The combination of `Access-Control-Allow-Credentials: true` and
`Access-Control-Allow-Origin: *` is illegal for CORS specifications:
https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
This commit is contained in:
Alex Dupre 2022-06-22 09:36:48 +02:00 committed by Alexandre Bodin
parent 8b2108a940
commit 556c0e789d

View File

@ -40,7 +40,7 @@ module.exports = config => {
const requestOrigin = ctx.accept.headers.origin;
if (whitelist.includes('*')) {
return '*';
return credentials ? requestOrigin : '*';
}
if (!whitelist.includes(requestOrigin)) {