mirror of
https://github.com/willnorris/imageproxy.git
synced 2026-04-26 13:26:23 +02:00
allow customizing response headers passed to client
A nil slice of headers will use the previous set of default response headers to maintain existing behavior. The same list of headers is repeated as the default flag value in `cmd/imageproxy` as documentation for users to know what values they are overriding (and might want to still include). Fixes #387
This commit is contained in:
parent
554bfc5d8e
commit
7f3639886b
2 changed files with 17 additions and 1 deletions
|
|
@ -39,6 +39,7 @@ var includeReferer = flag.Bool("includeReferer", false, "include referer header
|
|||
var followRedirects = flag.Bool("followRedirects", true, "follow redirects")
|
||||
var baseURL = flag.String("baseURL", "", "default base URL for relative remote URLs")
|
||||
var passRequestHeaders = flag.String("passRequestHeaders", "", "comma separatetd list of request headers to pass to remote server")
|
||||
var passResponseHeaders = flag.String("passResponseHeaders", "Cache-Control,Last-Modified,Expires,Etag,Link", "comma separated list of response headers to pass from remote server")
|
||||
var cache tieredCache
|
||||
var signatureKeys signatureKeyList
|
||||
var scaleUp = flag.Bool("scaleUp", false, "allow images to scale beyond their original dimensions")
|
||||
|
|
@ -75,6 +76,12 @@ func main() {
|
|||
if *passRequestHeaders != "" {
|
||||
p.PassRequestHeaders = strings.Split(*passRequestHeaders, ",")
|
||||
}
|
||||
if *passResponseHeaders != "" {
|
||||
p.PassResponseHeaders = strings.Split(*passResponseHeaders, ",")
|
||||
} else {
|
||||
// set to a non-nil empty slice to pass no headers.
|
||||
p.PassResponseHeaders = []string{}
|
||||
}
|
||||
p.SignatureKeys = signatureKeys
|
||||
if *baseURL != "" {
|
||||
var err error
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue