Online Cache-Control Header Builder & Policy Explainer
Configure HTTP caching policies for browsers, reverse proxies, and CDNs. Learn what each directive does, avoid stale caching bugs, and export Nginx, Apache, and Netlify snippets.
1. Cache-Control Directives
Scope & Visibility
Storage & Revalidation
Freshness Durations
sec
sec
sec
2. Generated Policy
NGINX CONFIG:
HTTP Caching Best Practices
Efficient caching minimizes server load, reduces CDN bandwidth costs, and eliminates page latency for returning visitors.
Recommended Strategies
- Versioned / Hashed Static Assets: Use
public, max-age=31536000, immutable. Since modern build tools (Vite, Webpack) embed content hashes in filenames (e.g.app.7f82b.js), files are guaranteed to never change. - HTML Documents: Use
no-cache, must-revalidate. Browsers can store the HTML but must ping the origin with an ETag before displaying it, ensuring users always see new deployments immediately. - User-Specific API Payloads: Use
private, no-store. Prevents shared intermediate caches and CDNs from storing and leaking confidential user session data.