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

Response body size #9

Closed otbe closed 6 years ago

otbe commented 6 years ago

Hi,

some of our sites are prerendered bigger than 256k. I guess in this case the origin request lambda sets the uri to "/index.html" and discards the prerender cloud response !?

I wonder where the 256k comes from? Current limit of origin req/res edge lambdas is 1mb. Maybe we can increase this number? (Should I prepare a PR?)

Note: We observed a strange behavior if the response body is bigger than 256k. Cloudfront returned an outdated version of index.html. Outdated means: wrong content. We clear the cloudfront cache with every release, so it should not even be possible to happen. Any ideas whats going on?

Thanks for this great project!

jotto commented 6 years ago

I wonder where the 256k comes from? Current limit of origin req/res edge lambdas is 1mb. Maybe we can increase this number? (Should I prepare a PR?)

Yes, I think you're right: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html#limits-lambda-at-edge

It was originally 256k. It's time to change it here!

Note: We observed a strange behavior if the response body is bigger than 256k. Cloudfront returned an outdated version of index.html. Outdated means: wrong content. We clear the cloudfront cache with every release, so it should not even be possible to happen. Any ideas whats going on?

This is concerning. How are you clearing the CloudFront cache? Are you doing /*? Or are you invalidating specific paths?

otbe commented 6 years ago

Sorry for my late response.

It was originally 256k. It's time to change it here! Cool :)

This is concerning. How are you clearing the CloudFront cache? Are you doing /*? Or are you invalidating specific paths?

We use /* to invalidate the cache in our test setup.

otbe commented 6 years ago

Prepared an PR