allow custom User-Agent when fetching remote image

Closes #83
This commit is contained in:
Hugues Alary 2017-07-31 18:28:48 -07:00 committed by Will Norris
parent ab8916a938
commit 3444fd9cb4
2 changed files with 13 additions and 5 deletions

View file

@ -53,6 +53,7 @@ var timeout = flag.Duration("timeout", 0, "time limit for requests served by thi
var verbose = flag.Bool("verbose", false, "print verbose logging messages")
var version = 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")
func init() {
flag.Var(&cache, "cache", "location to cache images (see https://github.com/willnorris/imageproxy#cache)")
@ -98,6 +99,7 @@ func main() {
p.Timeout = *timeout
p.ScaleUp = *scaleUp
p.Verbose = *verbose
p.UserAgent = *userAgent
server := &http.Server{
Addr: *addr,