Keep max-age within an expiring image URL's lifetime (closes #63) #146

Merged
clawbot merged 3 commits from issue-63-cache-max-age into next 2026-09-29 03:51:58 +02:00
3 Commits
Author SHA1 Message Date
clawbot 9742842975 Document and test the one-year max-age cap (closes #63)
check / check (push) Successful in 2m43s
The README said max-age is the seconds left until the URL's expiry, but a
URL expiring more than a year away gets one year; it now says at most one
year. A new case for an encrypted URL with a two-year TTL expects
max-age=31536000.

Model: opus-5-5
2026-09-29 01:26:21 +00:00
clawbot 0a0142d1af Keep max-age within an expiring image URL's lifetime (closes #63)
Both image routes sent Cache-Control: public, max-age=31536000,
immutable, so a browser or proxy could keep serving an image for a year
after its signed or encrypted URL had expired. The header is now built
from the request's Expires: max-age is the whole seconds left until the
URL expires, never negative, or one year for a URL with no expiry.
ToImageRequest now carries an encrypted URL's expiry onto the request,
as the image route already does with exp. immutable stays: it only stops
revalidation while a copy is fresh, and freshness now ends at the
expiry. README.md documents the header.

Model: opus-5-5
2026-09-29 01:25:25 +00:00
clawbot ac95c33cdb Test that max-age never outlives an expiring image URL (closes #63)
Route tests for both image routes. An image served through a signed URL
expiring in 60 seconds, or an encrypted URL with a 60 second TTL, must
get a max-age of at most 60. A URL with no expiry keeps one year. An
allowlisted URL whose exp has already passed, which is served without
checking exp, must get 0. The expiring cases fail until the fix that
follows.

Model: opus-5-5
2026-09-29 01:25:25 +00:00