Skip to content

Commit bc19c1c

Browse files
committed
try using function url
1 parent fc903f1 commit bc19c1c

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

cloudformation/main.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,17 @@ Resources:
146146
!FindInMap [ApiGwConfig, !Ref RunEnvironment, HostedZoneId]
147147
CloudfrontDomain: !GetAtt [AppFrontendCloudfrontDistribution, DomainName]
148148

149+
AppLambdaUrl:
150+
Type: AWS::Lambda::Url
151+
Properties:
152+
AuthType: NONE
153+
Cors:
154+
AllowHeaders: "'Content-Type,Authorization,X-Amz-Date'"
155+
AllowOrigin: "'*'"
156+
MaxAge: "'300'"
157+
InvokeMode: BUFFERED
158+
TargetFunctionArn: !GetAtt AppApiLambdaFunction.Arn
159+
149160
AppApiLambdaFunction:
150161
Type: AWS::Serverless::Function
151162
DependsOn:
@@ -695,8 +706,8 @@ Resources:
695706
S3OriginConfig:
696707
OriginAccessIdentity: !Sub "origin-access-identity/cloudfront/${CloudFrontOriginAccessIdentity}"
697708
- Id: ApiGatewayOrigin
698-
DomainName: !Sub "${AppApiGateway}.execute-api.${AWS::Region}.amazonaws.com"
699-
OriginPath: "/default"
709+
DomainName: !GetAtt AppLambdaUrl.FunctionUrl
710+
OriginPath: "/"
700711
CustomOriginConfig:
701712
HTTPPort: 80
702713
HTTPSPort: 443

0 commit comments

Comments
 (0)