serverless-next.js
serverless-next.js copied to clipboard
Caching js, woff, css in public directory
Hey,
I have a need to implement a static site with routes augmented with nextjs.
Question on stackoverflow here: https://stackoverflow.com/questions/72147058/serverless-nextjs-will-not-cache-js-css-or-woff-in-public-directory
Caching works fine on everything else, but even with the below, it still won't cache. Any ideas please?
publicDirectoryCache:
value: public, max-age=0, s-maxage=86400
test: /\.(gif|jpe?g|png|txt|xml|css|js|woff)$/i
As a workaround I was thinking I could try just requireDir the css/woff/js from _app.js maybe?
Just an update for this, I've managed get it working by manually setting s3 cache setting after deployment and caching query params, some of the jquery libs and random other stuff have js query params.
Now this is still a valid question, why doesn't the above pattern set the cache for me I suppose, I'll have a dive into the code at some point this week but if anyone else has a plan?