I am trying to deploy my website to aws with cloudfront and route53. The site is deployed and running on https://higgle.io
However the assets are not loading, for the images are throwing 403. How do I fix it?
I am using serverless serverless-next.js
. And I was following one of their blog post to set it up.
So far I added which has serverless.yml
on the route level.
higgle:
component: serverless-next.js
and my next.config.js looks like
module.exports = {
target: 'serverless',
webpack: (config) => {
config.module.rules.push({
test: /\.svg$/,
use: ['@svgr/webpack'],
});
return config
}
}
While the folder structrs looks like
-root
-.next
-pages
-_document.js
-index.js
-public
-static
-favicon.ico
-next.config.js
-package.json
-serverless.yml
Any idea how to fix this? Thanks
S3 is returning a 403 because your items are private.
Your bucket policy should be:
{
"Version": "2012-10-17",
"Id": "Policy1517754859350",
"Statement": [
{
"Sid": "Stmt1517754856505",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::YOUR-BUCKET-NAME/*"
}
]
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With