---
name: azion-check-the-cache-status-of-a-response
description: >-
  Send one request with a debug header and read whether Azion served the response from its cache, together with the key the copy is stored under.
---

# Check the cache status of a response

You check whether [Cache](/en/documentation/platform/applications/#cache) served a response from a stored copy by requesting the object with a debug header and reading two response headers. The check runs from any machine with `curl`, and it needs no change to the application.

The same response carries the cache key the copy is stored under, which is the argument a cache key purge takes. For the key format and every status value, refer to [Cache keys](/en/documentation/platform/applications/cache/cache-keys/).

---

## Prerequisites

- `curl` on your machine.
- The URL of an object your application serves.

---

## Request the debug headers

The request header `Pragma: azion-debug-cache` makes Azion return the cache state of the response. To read it:

1. **Request the object with the debug header**

   The `-I` flag asks for the response headers alone, so the body is not downloaded:

   ```bash
   curl -sI -H "Pragma: azion-debug-cache" https://www.example.com/static/site.js
   ```

2. **Read the cache status**

   The `x-cache` header carries three values: the cache status, the IP address of the server that answered the request, and the protocol. Under HTTP/2, the header names arrive in lowercase:

   ```http
   x-cache: MISS from 192.0.2.10 with HTTP/2.0
   x-cache-key: httpswww.example.com/static/site.js
   ```

3. **Read the cache key**

   The `x-cache-key` header carries the key the copy is stored under. A cache key purge takes that value as its argument.

4. **Run the same command again**

   Compare the status of the second response with the first.

You now know whether the response came from the cache, from the origin, or was not cached at all.

---

## Read the status

`HIT` means the response was served from a stored copy and the origin was not asked. `MISS` means the object was not in the cache, so Azion fetched it from the origin and may store the response for later requests. A `-` in both headers means the content is restricted from caching.

The other values a response can carry are `EXPIRED`, `STALE`, `UPDATING`, `REVALIDATED`, and `BYPASS`. For what each one means, refer to [Cache keys](/en/documentation/platform/applications/cache/cache-keys/).

A `-` on a `POST` or `OPTIONS` request means caching is off for that method. To turn it on, refer to [Cache POST and OPTIONS responses](/en/documentation/guides/application-performance/cache-and-purge/cache-post-and-options-responses/).

---

## Next steps

- [Cache keys](/en/documentation/platform/applications/cache/cache-keys.md): The key format, every variation it can carry, and all eight cache status values.
- [Troubleshoot Applications](/en/documentation/platform/applications/troubleshooting.md#cache): What to check when a response carries no status, or stays MISS on every request.
- [Purge cached content](/en/documentation/guides/application-performance/cache-and-purge/purge-cached-content.md): Remove the copy this key names, before its TTL ends.
- [Expiration and freshness](/en/documentation/platform/applications/cache/expiration-and-freshness.md): Why a request is answered from a copy, from the origin, or not cached at all.
