When I run the app locally in production mode, the Cache-Control headers are set as expected. However, in Netlify, the returned Cache-Control headers are always set to public, max-age=0, must-revalidate. Why is this? And is there any way around this?
Hi, @alex.hedlund. Would you please share a URL with us where the headers should be present but are not?
I want to confirm if the URL is being handled by a static file, SSR or ISR (the ODB function).
You can post that information publicly or you can private message (PM) that to one of our support staff. I’ve confirmed that PMs are enabled for your forum login. Please keep in mind that only one person can see the PM and this will likely mean a slower reply than posting the information publicly. Please feel free to reply to however you prefer though.
We confirmed with the devs and yes, it’s not possible to set a custom cache control headers because it will cause weird issues especially when you re-deploy.
Also, it appears that you’re trying to use SWR, so could you probably convert the page to ISR and get the feature you need.
Thanks for the confirmation. I feel like this could be better documented in the Netlify docs since this restriction isn’t in place at other hosting platforms.
ISR can be an option at sometimes, but sometimes you need server-side rendering, and with SSR in production you often need cache-control headers.
Hillary here from the Support team! I just wanted to follow up and let you know that after reviewing this thread, our Docs team has implemented your feedback to include that we don’t support cache-control in the docs, as well as provide some more guidance.
Thanks again for taking the time to share your feedback with us. This helps us improve our product!