Problem Statement
Which headers help a CDN cache and validate browser content efficiently?
Explanation
Cache-Control sets TTL and revalidation behavior. ETag or Last-Modified enables conditional requests. Vary declares which request headers are part of the cache key (e.g., Accept-Encoding, Authorization when needed).
These controls prevent stale or incorrect variants from being served.
Code Solution
SolutionRead Only
Cache-Control: public, max-age=300, stale-while-revalidate=30 ETag: "ab12" Vary: Accept-Encoding
