Skip to main content
Guides/Site Performance

Cache Headers: Understand and Use the Results

Analyze caching configuration

EdgeDNS Team·Updated ·4 min read

HTTP caching: how websites avoid downloading the same thing twice

HTTP caching is the practice of telling browsers (and intermediate caches like CDNs) that a particular response can be stored and reused for future requests, instead of re-downloading the same file every time. The mechanism is a small set of HTTP response headers — `Cache-Control`, `ETag`, `Last-Modified`, `Expires`, and a few others — that the server sends along with each response. Together they let the server say things like "this image is fine for the next year," "this CSS file is the same as version XYZ from last week," or "this API response is private and shouldn't be cached at all." The browser obeys these instructions and decides whether to make a fresh request or use the local copy.

You should care because HTTP caching is the single biggest reason a website feels fast on a return visit. The first time a user visits, the browser has to download every CSS file, every JavaScript bundle, every image, every font. Without caching, the second visit downloads exactly the same files all over again. With proper caching, the second visit is essentially free — the browser uses its cached copies and the page renders almost instantly. The difference between a website that feels snappy on repeat visits and one that feels slow forever is almost always cache headers.

The five things every caching audit looks at:

  • Static asset cache lifetimes. Long-lived files (CSS, JS, images, fonts) with versioned URLs should have very long cache lifetimes, often a year (`max-age=31536000, immutable`).

  • HTML cache lifetimes. HTML pages should usually have short cache lifetimes (or `no-cache` with `ETag`) so users see updates quickly.

  • Public vs private caching. `public` lets shared caches (CDNs, proxies) cache the response; `private` restricts it to the user's own browser. Getting this wrong leaks personalized data to other users.

  • Conditional requests. `ETag` and `Last-Modified` headers let the browser ask "is this still current?" and get a tiny `304 Not Modified` response if so — much cheaper than re-downloading the full file.

  • Cache busting via versioned URLs. The standard pattern is to put a content hash in every file name (`main.a1b2c3.js`), so any change to the file produces a new URL and the old cache entry naturally falls out.

Three questions a caching audit answers:

  • Are my static assets actually being cached on repeat visits, or being re-downloaded every time?

  • Am I accidentally caching personalized content in public caches, leaking it to other users?

  • After my recent CMS or framework upgrade, did the cache headers regress?

The cost of bad caching is the slow, invisible degradation of repeat-visit performance. Users don't say "the cache headers are wrong" — they just say the site feels slow. The fix is a one-time configuration pass at the server, framework, or CDN level. The HTTP caching specification is documented in RFC 9111.

The Cache Headers endpoint, in plain language

Analyze caching configuration

Proper caching reduces server load, improves performance, and saves bandwidth. Analyzing cache headers helps identify misconfiguration, contradictory directives, and security issues like sensitive data being cached by shared proxies.

What is actually happening when you call it

Examines all cache-related HTTP (HyperText Transfer Protocol) headers and parses Cache-Control directives (max-age, s-maxage, no-cache, no-store, private, public, immutable, stale-while-revalidate, stale-if-error). Detects CDN (Content Delivery Network) providers and their cache hit/miss status. Identifies contradictory directives, security risks like Set-Cookie on public responses, and provides a human-readable summary of the caching behavior.

Why this specific tool matters

Choose a task: Performance Debugging. Debug why content isn't being cached properly by analyzing cache header configuration.

Run the Cache Headers request below and retain the input and observed result. Before changing configuration, compare the relevant fields with the value or policy you expected. Use the Cache Headers reference to check the field definitions and supported options.

Info:

Available on the free plan. The technical details: `GET /v1/domain/cache`.

When would I actually use this?

Performance Debugging

Debug why content isn't being cached properly by analyzing cache header configuration.

Use the finding: Fix caching issues improving repeat visit performance.

CDN Optimization

Verify cache headers are set correctly for CDN (Content Delivery Network) edge caching.

Use the finding: Maximize CDN (Content Delivery Network) cache hit rates for better performance and lower origin load.

Security Review

Ensure sensitive pages have proper no-cache/no-store headers.

Use the finding: Prevent sensitive data from being cached inappropriately.

The easiest way: just ask your AI assistant

Connect the MCP server. Just ask in plain English:

Use domain_cache with domain=https://example.com. Show the returned findings, identify unavailable evidence, and explain a useful next check.

Confirm the tool and inputs in the client before accepting its summary. For Cache Headers, use the response fields below to separate observations from recommendations.

Tip:

The dedicated MCP server is available on every plan. Individual tool access and request limits depend on your plan. Management categories and endpoints disabled for the tool catalog are not exposed through MCP.

The technical way: call it from code

This Cache Headers request uses the example inputs from its API contract. Replace YOUR_API_KEY with a key on the free plan or higher; adapt the target to your task.

bash
curl --request GET 'https://api.edgedns.dev/v1/domain/cache?domain=https%3A%2F%2Fexample.com' \
  --header "Authorization: Bearer YOUR_API_KEY"

Prepare inputs for Cache Headers

Start with the inputs below. Keep the same hostname, path, and options when comparing Cache Headers observations. The API reference contains the complete parameter contract, optional settings, and access requirements.

FieldTypeRequired?What it meansExample

domain

string

Yes

Domain or full URL (web address) — accepts `example.com` or `HTTPS://example.com/path`.

https://example.com

Interpret Cache Headers findings

Read these fields alongside the full response from your Cache Headers check. A missing value or failed lookup is different from a passing result. Keep returned errors and confidence or cache metadata when available; do not replace missing evidence with a successful default. See the complete response reference for additional fields.

FieldTypeWhat you'll see in it

domain

string

The queried domain (bare hostname).

url

string

Full URL (web address) that was fetched, echoing the protocol used in the request.

testedUrl

string

The full URL (web address) tested (includes path when supplied)

Words you might be wondering about

CDN (Content Delivery Network) — A worldwide network of servers that store copies of your website close to your visitors so pages load fast.

HTTP (HyperText Transfer Protocol) — The language web browsers and websites use to talk to each other.

Need Programmatic Access?

Automate domain intelligence with 100+ API endpoints and a free MCP server for AI integration.

Cache Headers: Results Guide | EdgeDNS