How to add cache headers to SSR routes? #68368
Replies: 1 comment 7 replies
-
|
We don't host on Vercel, so maybe it's different than a typical setup, but: If memory serves, I believe we had to add export const dynamic = "force-static"; to the dynamic page.tsx files and that enabled the chunks to cache with Cloudflare. I believe we also used exported const revalidate = 60; as needed in the same page.tsx files. Obviously change this value to suit needs. (This was for nextjs 14 app router) I recall we also had to set the asset prefix in the next config file like so: const nextConfig = { Our pages do not use query params, so I'm not sure if this is relevant in that context. Just thought I'd pass it along as I recall it being a head scratcher when I had to do it before. Good luck! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I need to be able to set cache headers so that data chunks and rendered pages will get cached in cloudfront, even when query params are used. In PHP (or next.js pages router) this would be a 10 second problem. How do I do the same thing in next.js app router?
Beta Was this translation helpful? Give feedback.
All reactions