sanfrancesco / prerendercloud-lambda-edge

Pre-render CloudFront with this Lambda@Edge function. Powered by https://headless-render-api.com (formerly named prerender.cloud from 2016 - 2022)
https://headless-render-api.com
MIT License
206 stars 35 forks source link

Question: Do you use this for subsequent deploys? #2

Closed kjanoudi closed 6 years ago

kjanoudi commented 6 years ago

If i have a code change, should i be using this script to deploy my new code every time, or can i simply invalidate in cloudfront as i used to do before adding the lambda@edge functions using this repo? Will the prerendered versions pick up on the invalidation and automatically re-fetch on the next request, or will prerender be out of sync with my cloudfront?

jotto commented 6 years ago

should i be using this script to deploy my new code every time

No. If you change your website (html or JavaScript), you should only have to invalidate CloudFront.

I should clarify that in the docs.

Caveat: By default, Prerender.cloud will cache on its servers for 5 minutes, so it's possible prerender.cloud will return out-dated cache after you invalidate CloudFront.

You can disable the server cache with: prerendercloud.set('disableServerCache', true); (edit handler.js and re-deploy the Lambda@Edge function).

I also, still, need to create an API method still for invalidating the entire cache on prerender.cloud's servers.

kjanoudi commented 6 years ago

Thanks!