Skip to content

Instantly share code, notes, and snippets.

@thanakijwanavit
Last active March 12, 2021 17:01
Show Gist options
  • Save thanakijwanavit/1a16db5a8a40c9020be0ec268cc0d81c to your computer and use it in GitHub Desktop.
Save thanakijwanavit/1a16db5a8a40c9020be0ec268cc0d81c to your computer and use it in GitHub Desktop.
apiGateway Cors
Resources:
Api:
Type: AWS::Serverless::Api
Properties:
StageName: Prod
Cors:
AllowHeaders: "'*'"
AllowMethods: "'*'"
AllowOrigin: "'*'"
EndpointConfiguration:
Type: EDGE
AWSTemplateFormatVersion: 2010-09-09
Resources:
CloudFrontCachePolicy:
Type: AWS::CloudFront::CachePolicy
Properties:
CachePolicyConfig:
CachePolicyConfig
cloudfrontdistribution:
Type: AWS::CloudFront::Distribution
Properties:
Restrictions:
GeoRestriction:
RestrictionType: whitelist
Locations:
- TH
- SG
- US
- UK
DistributionConfig:
CacheBehaviors:
- LambdaFunctionAssociations:
- EventType: string-value
LambdaFunctionARN: string-value
OriginCustomHeaders:
- HeaderName: Access-Control-Allow-Origin
HeaderValue: *
- HeaderName: Access-Control-Allow-Methods
HeaderValue: *
- HeaderName: Access-Control-Allow-Headers
HeaderValue: *
Origins:
- DomainName: !Sub "${OrismaSearchApi}.execute-api.${AWS::Region}.amazonaws.com"
OriginPath: "/Prod/orismaSearch"
Id: orismasearchorigin
ConnectionTimeout: 5
OriginCustomHeaders:
- HeaderName: Access-Control-Allow-Origin
HeaderValue: "*"
- HeaderName: Access-Control-Allow-Methods
HeaderValue: "*"
- HeaderName: Access-Control-Allow-Headers
HeaderValue: "*"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment