joostfarla / serverless-cors-plugin

Serverless CORS Plugin - Managing Cross-origin resource sharing (CORS) policies
ISC License
70 stars 15 forks source link

using allowCredentials with s3.amazonaws.com #26

Closed gladkikhartem closed 8 years ago

gladkikhartem commented 8 years ago

For some reason, allowCredentials option is not working on s3.amazonaws.com. Looks like some trouble with OPTIONS part of request.

Anyway ,changing
if (populatedEndpoint.method === 'GET' && !_.isUndefined(policy.allowCredentials)) { to if ( !_.isUndefined(policy.allowCredentials)) { solved the issue.

I'm posting this just in case someone may face similar problem in future.

asprouse commented 8 years ago

The Access-Control-Allow-Credentials header is required on non-GET requests even if the preflight has it in Chrome. This is not specific to s3 and seems like a bug to me.

gladkikhartem commented 8 years ago

Thank you for the fix :)