I've been noting a lot of cache misses from CloudFront. It seems it's due to forwarding all cookies & query parameters, even when there's no lambda involved (e.g. _next/* static html pages). From the code, it looks like this is hardcoded. Is this on purpose / is there a rationale about forwarding cookies for static pages?
Describe the solution you'd like
Configure cookies/query parameters to not be forwarded
Alternatively, #270 would solve this if there was some documentation added around required configuration for good cache performance.
Describe alternatives you've considered
If changing that by default is problematic, could it be configurable?
Additional context
Happy to make a pull request, with some suggestions around whether to change by default or make it configurable - just let me know the best approach here!
@AaronMoat _next/* requests are returned from cache (set to 86400 seconds). e.g.


It is true however that cookies are being forwarded for _next/* which it probably shouldn't.
For ssr and api page requests it is necessary to forward cookies for authentication / session cookies etc.
In terms of static pages generated by next's build, they could be cached in a more clever way, for which I'm currently looking into options.
Does that make sense?
Yeah, that makes sense. I was specifically talking about static pages - I was getting cloudfront misses constantly, on all assets, and then I turned off cookie/header forwarding manually and got cloudfront hits.
This shouldn't be an issue anymore. You can now further customise the cloudfront distribution. Please see https://github.com/danielcondemarin/serverless-next.js#custom-cloudfront-configuration
Most helpful comment
This shouldn't be an issue anymore. You can now further customise the cloudfront distribution. Please see https://github.com/danielcondemarin/serverless-next.js#custom-cloudfront-configuration