Skip to main content

Cache Headers API

free
GET/v1/domain/cache

Analyzes HTTP caching headers to understand how content is cached by browsers and CDNs. Evaluates Cache-Control, ETag, Last-Modified, Vary, and Pragma headers. Detects CDN providers (Cloudflare, Fastly, CloudFront, Vercel, Akamai, Netlify) and reports cache status. Identifies conflicts, security issues, and optimization opportunities.

What It Does

Examines all cache-related HTTP 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 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 It's Useful

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.

Use Cases

Frontend Developer

Performance Debugging

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

Fix caching issues improving repeat visit performance.

DevOps Engineer

CDN Optimization

Verify cache headers are set correctly for CDN edge caching.

Maximize CDN cache hit rates for better performance and lower origin load.

Security Engineer

Security Review

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

Prevent sensitive data from being cached inappropriately.

Parameters

NameLocationTypeRequiredDescription
domainquerystringRequiredDomain or full URL — accepts `example.com` or `https://example.com/path`.Example: https://example.com
pathquerystringOptionalOptional path to audit a specific asset (e.g. /static/main.css) — static assets typically have very different cache rules than HTMLExample: /static/main.css

Response Fields

Result fields below are inside the JSON data object. Any row named meta describes the sibling response metadata object. See response and error handling for status codes and error responses. Optional observations may be absent or null; inspect warnings and partial-failure fields before treating a missing result as a negative finding.

FieldTypeDescription
domainstringThe queried domain (bare hostname).
urlstringFull URL that was fetched, echoing the protocol used in the request.
testedUrlstringThe full URL tested (includes path when supplied)
statusCodenumberHTTP status code of the response
contentTypestringContent-Type of the response
isCacheablebooleanWhether the response is cacheable
summarystringHuman-readable summary of the caching behavior
cacheControlobjectParsed Cache-Control directives (public, private, noCache, noStore, maxAge, sMaxAge, mustRevalidate, proxyRevalidate, noTransform, immutable, staleWhileRevalidate, staleIfError)
cdnTargetedobjectCDN-targeted directives — CDN-Cache-Control (RFC 9213), Cloudflare-CDN-Cache-Control, Vercel-CDN-Cache-Control, Surrogate-Control, Cache-Tag, Surrogate-Key
etagstringETag header value
etagValidatesbooleanWhether If-None-Match returns 304. False indicates ETag is set but conditional validation is broken
lastModifiedstringLast-Modified header value
varyarrayVary header values
expiresstringExpires header value
agenumberAge header value in seconds
pragmastringPragma header value (legacy HTTP/1.0)
effectiveTtlnumberEffective TTL in seconds (priority: s-maxage > max-age > expires)
ttlFormattedstringHuman-readable TTL duration
remainingTtlnumberSeconds of freshness remaining at the edge (effectiveTtl − age)
remainingTtlFormattedstringHuman-readable remaining freshness
freshnessPercentLeftnumber0–100 — percentage of effectiveTtl still fresh
cdnobjectCDN detection result (detected, provider, cacheStatus, edgeLocation)
issuesarrayCaching issues and conflicts detected (including Vary Cookie/Origin antipatterns and stale-at-edge warnings)
recommendationsarrayCaching optimization and security suggestions

Code Examples

Replace YOUR_API_KEY with your API key. This endpoint requires the free plan or higher; see plans and usage limits.

cURL
curl --request GET 'https://api.edgedns.dev/v1/domain/cache?domain=https%3A%2F%2Fexample.com' \
  --header "Authorization: Bearer YOUR_API_KEY"
JavaScript
const response = await fetch(
  "https://api.edgedns.dev/v1/domain/cache?domain=https%3A%2F%2Fexample.com",
  {
    "method": "GET",
    "headers": {
      "Authorization": "Bearer YOUR_API_KEY"
    }
  }
);

if (!response.ok) {
  throw new Error(`EdgeDNS returned HTTP ${response.status}`);
}
const data = await response.json();
console.log(data);
Python
import requests

response = requests.request(
    'GET',
    "https://api.edgedns.dev/v1/domain/cache?domain=https%3A%2F%2Fexample.com",
    headers={'Authorization': 'Bearer YOUR_API_KEY'},
    timeout=60,
)
response.raise_for_status()
data = response.json()
print(data)

Read the full Cache Headers guide

Learn the concepts, choose a practical workflow, and interpret the observations from Cache Headers before acting on them. Run supported checks via MCP or through REST.

Read the guide →

Related Endpoints

External References

Learn more about the standards and protocols behind this endpoint.

Try This Endpoint

Test the Cache Headers endpoint live in the playground.

Cache Headers API Reference | EdgeDNS