mirror of
https://github.com/willnorris/imageproxy.git
synced 2026-04-26 21:36:24 +02:00
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:
parent
82ce506905
commit
7502adde1c
6 changed files with 181 additions and 4 deletions
|
|
@ -46,6 +46,7 @@ var verbose = flag.Bool("verbose", false, "print verbose logging messages")
|
|||
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")
|
||||
|
||||
func init() {
|
||||
flag.Var(&cache, "cache", "location to cache images (see https://github.com/willnorris/imageproxy#cache)")
|
||||
|
|
@ -87,6 +88,7 @@ func main() {
|
|||
p.ScaleUp = *scaleUp
|
||||
p.Verbose = *verbose
|
||||
p.UserAgent = *userAgent
|
||||
p.MinimumCacheDuration = *minCacheDuration
|
||||
|
||||
server := &http.Server{
|
||||
Addr: *addr,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue