How to AllowOrigin in AWS

Viewed 12

I am using CloudFormation and I have a simple REST API

Resources:
 RestApi:
  Type: AWS::Serverless::Api
  Properties:
   StageName: Prod
   Cors:
    AllowOrigin: !Ref AllowedOrigins
    AllowMethods: "'GET,POST'"
    AllowHeaders: "'Authorization, Content-Type'"
    AllowCredentials: false
    MaxAge: "'3600'"

AllowedOrigins is a Parameter with comma separated URLs http://localhost:8080,http://localhost:4200

Parameters:
 AllowedOrigins: 
  Type: String
  Default: '{{resolve:secretsmanager:/secret/myApp:SecretString:ALLOWED_ORIGINS}}'

ERROR:

Errors found during import: Unable to put integration response on 'OPTIONS' for resource at path '/cars': Invalid mapping expression specified: Validation Result: warnings : [], errors : [Invalid mapping expression specified: http://localhost:8080,http://localhost:4200] (Service: AmazonApiGateway; Status Code: 400; Error Code: BadRequestException; Request ID: 98b5a6f8-c3ca-424f-b6bf-a3b0c84d1624; Proxy: null)

How can I allow multiple URLs? I DO NOT WANT TO USE *

0 Answers
Related