[NextOnPages] cloudflare does not cache anything

The documentation still specifies ways to setup NextJs on cloudflare such that requests are cached. But it appears this is no longer the case (compat date 2024-11-11), no fetch requests i make are being cached. the documentation mentions nothing of this. https://developers.cloudflare.com/pages/framework-guides/nextjs/ssr/caching/ is there any workaround for this? related github issue: https://github.com/cloudflare/next-on-pages/issues/799
Cloudflare Docs
Caching and data revalidation in your Next.js app · Cloudflare Page...
@cloudflare/next-on-pages supports caching and revalidating data returned by subrequests you make in your app by calling fetch().
GitHub
[🐛 Bug]: Next fetch caching having issues in [email protected] ·...
next-on-pages environment related information System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.5.0: Wed May 1 20:17:33 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6031 CPU...
9 Replies
Vero
Vero3w ago
@James Do you know if there's a workaround for this?
James
James3w ago
Reading the linked issue, it sounds like something changed in Nextjs between the two versions which broke our caching implementation. Not aware of any workarounds other than downgrading or migrating to opennext
Vero
Vero3w ago
thanks James
ilovemesomeramen
ilovemesomeramenOP2w ago
the issue with downgrading is it breaks other stuff, so the only way would be to build a custom cache implementation using the cloudflare api? maybe an update to the docs would be nice, since it is rather confusing atm
James
James2w ago
I would honestly recommend evaluating whether you can migrate to the OpenNext adaptor - we have a lot of cache stuff being shipped at the moment
ilovemesomeramen
ilovemesomeramenOP2w ago
i will have a look at it but considering it is pre 1.0 i assume that there will be a lot of changes so im not sure if it is ready for production but i guess i will not have many options considering next on pages is now also broken for 14.2.25 which fixed CVE-2025-29927
James
James2w ago
That's a fair comment. I would note that you should be able to mitigate that vulnerability with a firewall rule as well. I believe you have to opt-in to it: https://developers.cloudflare.com/waf/change-log/2025-03-22-emergency/
ilovemesomeramen
ilovemesomeramenOP2w ago
considering i do not have an enterprise plan this will not work for me, i will look into alternatives
ilovemesomeramen
ilovemesomeramenOP2w ago
i looked at the wrong place of course i can fix it with a non enterprise plan whoops https://developers.cloudflare.com/changelog/2025-03-22-next-js-vulnerability-waf/

Did you find this page helpful?