Does Cloudflare now support Cache-Control for Next JS SSR?

Hello

I want to ask about Cloudflare Cache-Control, does it support caching for Next JS getServerSideProps SSR now?

Next JS official documentation recommends using Cache-Control for caching the SSR response, with some note, saying Your deployment provider must support caching for dynamic responses.

There was a github discussion on next.js repository in 2020 saying Assuming you're not on a cloudflare enterprise plan. Cloudflare does not support caching responses from a server on their normal plans.

I want to ask if this is still the case? I am currently using Pro plan.

What is this referring to specifically? This has pretty much never been the case.

Dynamic in what way? As in you have per-user functionality?

Cloudflare’s cache would serve the same cached asset to all of your users. https://support.cloudflare.com/hc/en-us/articles/360021023712-Best-Practices-Speed-up-your-Site-with-Custom-Caching-via-Cloudflare-Page-Rules

Hi KianNH, thanks for answering.

The term dynamic also confuses me, but at least the goal is to have edge caching works by setting Cache-Control like this

res.setHeader(
    'Cache-Control',
    'public, s-maxage=10, stale-while-revalidate=59'
  )

I refered to this nextjs[.]org /docs/going-to-production#caching
And the github discussion is in here github[.]com /vercel/next.js/issues/20380#issuecomment-749537226

(sorry I seems can’t include link in my post)

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.