-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Open
Description
We cannot get CORS to work with BinaryMediaTypes
Error message:
OPTIONS https://URL 500
Access to XMLHttpRequest at 'https://URL' from origin 'http://localhost:8000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-
Control-Allow-Origin' header is present on the requested resource.
This is our sam template:
Resources:
ApiName:
Type: AWS::Serverless::Api
Properties:
StageName: development
BinaryMediaTypes:
- '*~1*'
Cors:
AllowMethods: "'*'"
AllowHeaders: "'*'"
AllowOrigin: "'*'"
Auth:
DefaultAuthorizer: CognitoAuthorizer
AddDefaultAuthorizerToCorsPreflight: false
Authorizers:
CognitoAuthorizer:
UserPoolArn: 'USER_POOL'
As soon as we remove the "BinaryMediaTypes" option, the request works.
SAM CLI, version 0.37.0
tmvnk, averydev, marinaglancy, hhowe29, nhardy and 2 more