imageproxy
imageproxy copied to clipboard
option to override remote image expire
This PR:
Gives user the option to override the remote image hosting's expire date.
imageproxy -override-cache-control="public" -override-expires="Sat, 28 Dec 2199 04:09:32 GMT"
closes https://github.com/willnorris/imageproxy/issues/207
I'll take a closer look at thing later, but my initial thought is that we should probably expose this through a "minCacheDuration" flag using flag.Duration. Then, we only use that value if it is longer than the cache duration from the origin server. (We can also set cache-control: public
if that's necessary, though I can't remember the behavior of the httpcache package.)
Also, I'll probably want to put some kind of warning in the documentation for this, noting that it is overriding the instructions from the origin server and could cause problems if the origin is not expecting the image to be cached.
See also previous related feature requests: #28 #144
@willnorris that sounds reasonable to automatically set it to "public" and also good idea to print a warning to the user.
admitably I don't know enough about other use cases of Cache-Control. so I set it to public assuming that is what would solve it.