---
title: "Configure Cache Control"
description: "Configure custom CDN cache TTL using Cache-Control max-age and Expires headers to optimize content delivery and reduce origin requests."
url: https://community.exoscale.com/product/networking/cdn/how-to/cache-control/
product: "CDN"
section: product
last_updated: 2026-06-03
---
> For AI agents: the documentation index is at https://community.exoscale.com/llms.txt. Every page is available as markdown at `<page URL>index.md` or with `Accept: text/markdown`.

# Configure Cache Control

You can set `expires` or `cache-control` headers on individual SOS objects to customize the CDN cache TTL beyond the 7-day default.

## Understanding Cache-Control max-age

The `cache-control: max-age` directive behaves like a TTL for cached objects. It tells the CDN how long an object is considered fresh. During that time, the cached copy can be re-served without contacting the origin. Once expired, the cache may revalidate with the origin or re-download the resource, depending on the directives.

## Using Cache-Control

Examples of cache-control settings:

**1-hour TTL:**
```
Cache-Control: public, max-age=3600
```

**72-hour TTL:**
```
Cache-Control: public, max-age=259200
```

**7-day TTL:**
```
Cache-Control: public, max-age=604800
```

The `max-age` value specifies how long (in seconds) a response remains fresh after generation. The `public` directive allows caching in shared caches like CDNs.

## Using Expires

Alternatively, you can set a specific expiration date:
```
Expires: Wed, 21 Oct 2023 07:28:00 GMT
```

## Best Practices

- Use longer `max-age` values for static assets that don't change frequently
- Consider using versioned URLs (e.g., `/styles.v2.css`) for assets that may need updates
- The CDN will respect these headers to determine caching behavior

For more detailed information on HTTP caching headers, see the [MDN Cache-Control documentation](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#response_directives).
