Keep max-age within an expiring image URL's lifetime (closes #63)
check / check (push) Successful in 12s
check / check (push) Successful in 12s
Both image routes sent Cache-Control: public, max-age=31536000, immutable unconditionally, so a browser or proxy could keep serving an image for a year after its signed or encrypted URL had expired. max-age is now the whole seconds left until the URL expires, never negative and at most one year; a URL with no expiry keeps one year. The 304 answer uses the same value. An encrypted URL's expiry now reaches ImageRequest.Expires through ToImageRequest. immutable stays: freshness now ends no later than the URL's expiry. README.md documents the header. Model: opus-5-5
This commit was merged in pull request #146.
This commit is contained in:
@@ -95,7 +95,8 @@ type ImageRequest struct {
|
||||
FitMode FitMode
|
||||
// Signature is the HMAC signature for non-allowlisted hosts
|
||||
Signature string
|
||||
// Expires is the signature expiration timestamp
|
||||
// Expires is when the URL expires: the exp of a signed URL, or the expiry
|
||||
// of an encrypted URL; the zero time if it has none
|
||||
Expires time.Time
|
||||
// AllowHTTP indicates whether HTTP (non-TLS) is allowed for this request
|
||||
AllowHTTP bool
|
||||
|
||||
Reference in New Issue
Block a user