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