Skill 4.3.5
Cache content based on request headers
Key Concepts
In Amazon CloudFront, a cache policy defines the cache key: which headers, query strings and cookies are included, plus TTLs. Only include what actually changes the response, such as Accept-Language for translated content, because every extra value reduces the cache hit ratio. An origin request policy forwards extra values to the origin without adding them to the cache key.
In API Gateway, REST API caching uses the method's cache key parameters, which can include headers, query strings and path parameters. Clients can send Cache-Control: max-age=0 to request a fresh response if the API allows cache invalidation.