mirror of
https://github.com/willnorris/imageproxy.git
synced 2026-05-03 16:52:40 +02:00
add -forceCache flag to override no-store and private directives
The httpcache package is intended only to be used in private caches, so it will cache responses marked `private` like normal. However, imageproxy is a shared cache, so these response should not be cached under normal circumstances. This change introduces a potentially breaking change to start respecting the `private` cache directive in responses. This also adds a new `-forceCache` flag to ignore the `private` and `no-store` directives, and cache all responses regardless.
This commit is contained in:
parent
8170536e41
commit
1ceba2538c
5 changed files with 104 additions and 16 deletions
|
|
@ -47,6 +47,7 @@ var _ = flag.Bool("version", false, "Deprecated: this flag does nothing")
|
|||
var contentTypes = flag.String("contentTypes", "image/*", "comma separated list of allowed content types")
|
||||
var userAgent = flag.String("userAgent", "willnorris/imageproxy", "specify the user-agent used by imageproxy when fetching images from origin website")
|
||||
var minCacheDuration = flag.Duration("minCacheDuration", 0, "minimum duration to cache remote images")
|
||||
var forceCache = flag.Bool("forceCache", false, "Ignore no-store and private directives in responses")
|
||||
|
||||
func init() {
|
||||
flag.Var(&cache, "cache", "location to cache images (see https://github.com/willnorris/imageproxy#cache)")
|
||||
|
|
@ -89,6 +90,7 @@ func main() {
|
|||
p.Verbose = *verbose
|
||||
p.UserAgent = *userAgent
|
||||
p.MinimumCacheDuration = *minCacheDuration
|
||||
p.ForceCache = *forceCache
|
||||
|
||||
server := &http.Server{
|
||||
Addr: *addr,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue