From c59df45ac7665eedb67b8d44910a29857cdd7dd0 Mon Sep 17 00:00:00 2001 From: Ricardo Tavares Date: Sat, 4 Oct 2025 01:11:33 +0100 Subject: [PATCH] perf(templates): added cloudflare cache headers for static files (#14069) ### What? Adds Cache-Control headers for the static files generated by Next.js (e.g. .js files). This follows a recommendation by the OpenNext team: https://opennext.js.org/cloudflare/caching#static-assets-caching ### Why? To avoid avoiding unnecessary revalidation requests caused by Workers Static Assets' default headers. ### How? By caching the static files for up to an year. Co-authored-by: Ricardo Tavares --- templates/with-cloudflare-d1/public/_headers | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 templates/with-cloudflare-d1/public/_headers diff --git a/templates/with-cloudflare-d1/public/_headers b/templates/with-cloudflare-d1/public/_headers new file mode 100644 index 000000000..e6320ab14 --- /dev/null +++ b/templates/with-cloudflare-d1/public/_headers @@ -0,0 +1,2 @@ +/_next/static/* + Cache-Control: public,max-age=31536000,immutable \ No newline at end of file