Replies: 13 comments
-
I can confirm that cache control won‘t be overwritten in public folder. I dont understand |
Beta Was this translation helpful? Give feedback.
-
I'm having the same problem. I use SSG with getStaticProps. I expected the files from the public folder to have |
Beta Was this translation helpful? Give feedback.
-
I also have the same issue. Deploying on Vercel using Any workaround to this? Apparently we cannot set https://nextjs.org/docs/api-reference/next.config.js/headers#cache-control |
Beta Was this translation helpful? Give feedback.
-
This issue is a showstopper for us. We cannot update the app for our users and we have thousands who are stuck with the old cache for good. Vercel team, please, fix this issue. |
Beta Was this translation helpful? Give feedback.
-
you may want to try header configuration file the platform you use provides. one that looks like below:
vercel: https://vercel.com/docs/concepts/edge-network/headers |
Beta Was this translation helpful? Give feedback.
-
Have there been any updates/workarounds on this issue? Is there any way to overwrite the "default" non-caching behaviour of /public assets? |
Beta Was this translation helpful? Give feedback.
-
I'm also encountering this issue. I'm building an app that does in-browser inference on a 300mb vision transformer, and the model is being re-downloaded with every request, which makes development from a vps particularly painful. I'm indifferent towards this issue for production servers - it seems like there are other ways of configuring asset caching there - but for dev, it'd really help me to cache files in public/. |
Beta Was this translation helpful? Give feedback.
-
Is there any workaround for how to cache an asset in a public folder? I'm using next 13.5.5, and the app loads an asset (it's a Unity build), on a specific page with a 600mb on a single Unity build file, and is being re-downloaded when the page is revisited. |
Beta Was this translation helpful? Give feedback.
-
haha this is joke, right? no ability to cache public assets? |
Beta Was this translation helpful? Give feedback.
-
Has there been any updates on this? I really do not understand the logic behind having the cache max-age as 0 for public static assets. |
Beta Was this translation helpful? Give feedback.
-
Surely an option should at least be provided to opt in and set a custom cache time for the public assets (combining it with stale-while-revalidate header for the optimal result). There are perfectly reasonable use-cases where the asset should not be freshly served from the Next.js server on each page view/request. In our case, the icons take 100-300ms to load in and cause absolutely unnecessary white-space until they load in... |
Beta Was this translation helpful? Give feedback.
-
I'm having the same issue, hope there would be a solution soon! thanks |
Beta Was this translation helpful? Give feedback.
-
Hi, we are having trouble setting custom cache behaviour for our assets in public folder, such as font files, svg and png images assets. By default we seem to get
cache-control: public, max-age=0
which differs for example from _next/static which has
cache-control: public, max-age=31536000, immutable
I would have expected assets put in public folder to have some default cache behaviour?
I've tried setting custom header in next.config.js like:
But nothing happens, at least not when testing locally. Then there is also this: https://nextjs.org/docs/api-reference/next.config.js/headers#cache-control which seems to indicate that even if I did get this to work, it would in fact not work in production?
We are using a cdn in front of our next server (not using Vercel) so we might have other ways around this, but it seems strange to me.
Beta Was this translation helpful? Give feedback.
All reactions