Netlify caching
Cache-control header to reach for
Dynamic responses (Functions, Edge Functions, Netlify Server, proxies) are NOT cached by default. You must opt in. Set Netlify-CDN-Cache-Control on the response:
import type { Context } from "@netlify/functions";
export default async (req: Request, context: Context) => {
return new Response("Hello world", {
headers: {
'Netlify-CDN-Cache-Control': 'public, durable, max-age=60, stale-while-revalidate=120'
}
});
};
Installs: 3.5K | GitHub stars: 57 | First seen: Feb 27, 2026


