-
-
Notifications
You must be signed in to change notification settings - Fork 455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CloudFront Support #95
Conversation
Hey @danielcondemarin ! |
@ulysset If you are using cloudfront you only need assetsBucketName. Next build asset (/_next/*) requests are handled by the cloudfront distribution so you don’t really need the assetPrefix in that case. |
Ok thank you! |
@ulysset Manually updating the distribution is a bad idea as it will drift the stack. |
CloudFront Support
Motivation
Currently, API Gateway is being used as a proxy to S3 to serve static assets from
/static
and/public
directories. Whilst this works, is not the best solution as API Gateway is not as cost effective as CloudFront, nor is designed to be used as a CDN.Also CloudFront comes with features such as compression, logging, domains, certificates etc.
Proposal
When
cloudFront
flag is set to true, a CloudFront distribution is created with API Gateway and S3 as origins._next
build assets andstatic/
orpublic/
folder assets are served from the S3 origin. Page requests, such as/blog/:post
are served from the API Gateway origin.This article was used as a reference for implementation:
https://aws.amazon.com/premiumsupport/knowledge-center/api-gateway-cloudfront-distribution/