allow overriding cache directives in responses

Add a new `-minCacheDuration` flag to specify a minimum duration to
cache images for.

Updates #28
Updates #144
Fixes #207
Fixes #208
This commit is contained in:
Will Norris 2025-04-28 23:43:10 -07:00
parent 82ce506905
commit 7502adde1c
6 changed files with 181 additions and 4 deletions

View file

@ -184,6 +184,18 @@ first check an in-memory cache for an image, followed by a gcs bucket:
[tiered fashion]: https://godoc.org/github.com/die-net/lrucache/twotier
#### Cache Duration
By default, images are cached for the duration specified in response headers.
If an image has no cache directives, or an explicit `Cache-Control: no-cache` header,
then the response is not cached.
To override the response cache directives, set a minimum time that response should be cached for.
This will ignore `no-cache` and `no-store` directives, and will set `max-age`
to the specified value if it is greater than the original `max-age` value.
imageproxy -cache /tmp/imageproxy -minCacheDuration 5m
### Allowed Referrer List
You can limit images to only be accessible for certain hosts in the HTTP