---
title: Set cache control headers for functions
description: Learn how to set headers to cache your function's responses.
url: /kb/guide/set-cache-control-headers
canonical_url: "https://vercel.com/kb/guide/set-cache-control-headers"
last_updated: 2026-07-16
authors: DX Team
related:
  - /docs/headers
  - /docs/edge-cache
  - /docs/incremental-static-regeneration
install_vercel_plugin: npx plugins add vercel/vercel-plugin
---

By default, the CDN and browser will not cache, unless you set the following headers in your function as needed: `Cache-Control`,`CDN-Cache-Control`, and `Vercel-CDN-Cache-Contol`. You can set these headers to:

- [Set the cache depending on location](#set-caching-depending-on-location)
  
- [Set the same cache duration everywhere](#same-cache-duration-everywhere)
  
- [Set caching for Vercel's Cache](#set-caching-for-vercel's-cache)
  
- [Set caching for all CDNs](#set-caching-for-all-cdns)
  

Setting the cache in functions takes priority over config files.

### Set caching depending on location

`export async function GET() { return new Response('Cache Control example', { status: 200, headers: { 'Cache-Control': 'max-age=10', 'CDN-Cache-Control': 'max-age=60', 'Vercel-CDN-Cache-Control': 'max-age=3600', }, }); }`

`export async function GET() { return new Response('Cache Control example', { status: 200, headers: { 'Cache-Control': 'max-age=10', 'CDN-Cache-Control': 'max-age=60', 'Vercel-CDN-Cache-Control': 'max-age=3600', }, }); }`

Vercel uses the following priority when you specify multiple cache control headers:

- `Vercel-CDN-Cache-Control`
  
- `CDN-Cache-Control`
  
- `Cache-Control`
  

### Same cache duration everywhere

This sets the same maximum cache duration for Vercel, CDNs, and the client:

`export async function GET() { return new Response('Cache Control example', { status: 200, headers: { 'Cache-Control': 'max-age=3600', }, }); }`

`export async function GET() { return new Response('Cache Control example', { status: 200, headers: { 'Cache-Control': 'max-age=3600', }, }); }`

### Set caching for Vercel's Cache

This sets the maximum cache duration for Vercel's Cache only.

`export async function GET() { return new Response('Cache Control example', { status: 200, headers: { 'Vercel-CDN-Cache-Control': 'max-age=3600', }, }); }`

`export async function GET() { return new Response('Cache Control example', { status: 200, headers: { 'Vercel-CDN-Cache-Control': 'max-age=3600', }, }); }`

### Set caching for all CDNs

This sets the cache duration on Vercel and also on other CDNs

`export async function GET() { return new Response('Cache Control example', { status: 200, headers: { 'CDN-Cache-Control': 'max-age=60', }, }); }`

`export async function GET() { return new Response('Cache Control example', { status: 200, headers: { 'CDN-Cache-Control': 'max-age=60', }, }); }`

## More resources

- [Caching Headers](/docs/headers#cache-control-header)
  
- [Vercel Cache](/docs/edge-cache)
  
- [ISR](/docs/incremental-static-regeneration)