What is the Cache-Control header?
The Cache-Control header specifies instructions for caching in both client browsers and intermediary proxies (like CDNs).
API Usage & Best Practices
- Disable caching for mutations: For POST, PUT, PATCH, and DELETE operations, ensure responses carry
Cache-Control: no-store, max-age=0. - Use for static lookups: If an API returns static configurations (like country lists), use
Cache-Control: public, max-age=86400to encourage caching.
Examples
HTTP/1.1 200 OKCache-Control: no-store, no-cache, must-revalidate