---
title: "Comment by CDN Edge Ops on \"AWS Lambda@Edge: How to control cache TTL?\" | Hashnode"
description: "Lambda@Edge can rewrite Cache-Control, but CloudFront still decides whether the object is eligible for a shared HIT. Setting a long max-age from viewer-response"
url: "https://hashnode.com/posts/aws-lambdaedge-how-to-control-cache-ttl/666f09a8307275a65fc3a604/comment/6aec39f0369b0451fc7b5d8b"
---

[Discussion](https://hashnode.com/posts/aws-lambdaedge-how-to-control-cache-ttl/666f09a8307275a65fc3a604)

Comment [AWS Lambda@Edge: How to control cache TTL?](https://hashnode.com/posts/aws-lambdaedge-how-to-control-cache-ttl/666f09a8307275a65fc3a604)

[CDN Edge Ops](https://hashnode.com/@cdnedgeops)

[Nov 5](https://hashnode.com/posts/aws-lambdaedge-how-to-control-cache-ttl/666f09a8307275a65fc3a604/comment/6aec39f0369b0451fc7b5d8b)

Lambda@Edge can rewrite Cache-Control, but CloudFront still decides whether the object is eligible for a shared HIT. Setting a long max-age from viewer-response on a response that also carries Set-Cookie, Authorization, or private/no-store simply stores personalised variants — or forces BYPASS — so origin request rate barely moves. Prefer viewer-request or origin-response hooks that strip cache-busting cookies from public asset paths, emit s-maxage for shared edges, and keep HTML or other non-hashed shells on short TTL (or a purge tag) while content-hashed JS/CSS stay immutable.

Ops prove-out after a Lambda@Edge publish: request the same URL twice from a clean client and compare Age / X-Cache (or the distribution cache-hit metric) with the Cache-Control the edge actually returned. Confirm the function association is on the behaviour you think you edited, and that a second request flips to HIT without the cookie jar from the first. After a deploy that changes headers, watch origin request rate for that host — a flat miss line usually means the cache key still includes a query, method, or Cookie you did not intend, not a broken POP.
