---
name: "X-Up-Expire-Cache"
area: "API"
kind: "HTTP header"
parent: "up.protocol module"
url: "https://unpoly.com/api/X-Up-Expire-Cache"
---
<nav aria-label="Unpoly docs">[All docs](https://unpoly.com/index.md) · [up.protocol module](https://unpoly.com/api/up.protocol.md)</nav>

# X-Up-Expire-Cache

The server may send this optional response header to control which previously [cached](https://unpoly.com/learn/caching.md) responses should be [expired](https://unpoly.com/learn/caching.md#expiration) when this response is received.

The value of this header is a [URL pattern](https://unpoly.com/api/url-patterns.md) matching responses that should be expired.

For example, to expire all responses to URLs starting with `/notes/`:

```http
X-Up-Expire-Cache: /notes/*
```

To expire all cache entries:

```http
X-Up-Expire-Cache: *
```

To expire nothing beyond what the client has already expired, send `false`:

```http
X-Up-Expire-Cache: false
```

## Relation to the client-side default {#relation-to-the-client-side-default}

When Unpoly sends a non-GET request, it [expires the entire cache](https://unpoly.com/api/up.network.config.md#config.expireCache) before the server responds. This header can only expire _additional_ entries. It cannot undo an expiration that has already happened.

To keep the cache fresh after a non-GET request, configure the client instead. For example, set an [`[up-expire-cache="false"]`](https://unpoly.com/api/up-follow.md#up-expire-cache) attribute on the link or form, or customize [`up.network.config.expireCache`](https://unpoly.com/api/up.network.config.md#config.expireCache).

