jinty / prerender-cloudfront

prerender.io cloudfront example middleware
MIT License
128 stars 51 forks source link

Does this work with AWS Amplify? #19

Open natarius opened 4 years ago

natarius commented 4 years ago

We are hosting a React single page app via AWS Amplify and need to serve crawlers (like Google search crawlers) a pre-rendered version of each page for SEO reasons.

I came across this repo here and wonder if anyone knows how would I go about configuring AWS Amplify to use it?

Thanks

daltonfury42 commented 3 years ago

Yes, a guide or some setup instructions would be really helpful.

justanotherjones commented 3 years ago

We had the exact same problem to solve as you. Unfortunately, I ended up migrating the app off of Amplify onto our own Cloudfront/S3 distribution because Amplify does not support running Lambda@Edge lambdas. There are a few other lambda triggers within Amplify, but not any that are helpful for this use case. And there's no way to access the underlying Cloudfront distribution that Amplify is running.

berenddeboer commented 3 years ago

I just added the relevant bits of the CloudFormation template to the amplify/backend/hosting/S3AndCloudFront/template.json and that works fine.

We already had a lambda@edge function doing path rewrites/redirects, so we just added the relevant bits from this code to there as well.

wyckojr commented 2 years ago

@berenddeboer is there any chance you could provide a more step-by-step of what you needed to do in Amplify to get this to work? We have a full Amplify Next.js site, but have not implemented an Amplify backend because we didn't need one.