I'm not entirely sure why I had this in the first place... probably just
a misunderstanding at the time of what a mux did and when it is helpful.
In this case, it serves no purpose.
This has begun failing with the error:
error generating coverage report: write |1: file already closed
I'm not 100% sure what's causing this, but this test isn't actually
covering very much, and trying to test a main function is often fraught
anyway, so it's not worth the hassle.
Add a new passRequestHeaders field to Proxy that identifies headers to
pass from inbound request to remote servers. Also add associated flag
to imageproxy CLI.
This is initially added to support remote servers that require an
authorization token.
Fixes#321
- switch to "project authors" style copyright. Instead of an AUTHORS
file (https://opensource.google/docs/releasing/authors/), I just list
Google as a major copyright holder in the README.
- use SPDX style license headers in source files
- remove CLA requirement from contributing docs
Thanks to @Fieldistor for the reminder that gorilla/mux allows you to
disable cleaning request URLs, which was causing problems with signature
verification for some URLs.
Fixes#215Fixes#212
this is an optional feature which is disabled by default, since it is
only needed in a few select cases and risks accidentally exposing
internal URLs.
Fixes#216
when parsing cache values, if the values doesn't match a recognized URL
pattern, we treat it as a filepath for an on-disk cache. However, this
doesn't appear to be working on Windows. I don't have easy access to a
Windows box to test this on, but I *think* this should fix it.
Refs #181
this is necessary for the new environment variable support for config
values. I don't love that allowHosts is comma separated and cache is
space separated :(
This is what I probably should have called this when I renamed it back
in 70276f36, since this makes it more obvious that it's a list of
allowed hosts. Renaming now to make room for a `DenyHosts` variable as
part of #85.
If no content types are specified, then accept all responses, regardless
of content type (this is the behavior imageproxy has historically had).
Change default value for the contentTypes flag to be "image/*", so that
the new default when running cmd/imageproxy is that only images will be
proxied. The old default behavior can be achieved by passing an empty
string for the contentTypes flag:
imageproxy -contentTypes ""
Do not send the "XCTO: nosniff" header, since all documentation that I
can find still says that it can cause problems when served with images.
If it's effectively a noop when an explicit content-type is specified in
the response, then this shouldn't actually matter for us either way.
But in the absence of certainty, I'd rather err on the side of following
the spec.
Also add documentation for the new functionality.
Fixes#141
The -cache flag can be specified multiple times to create a tier of
caches. Typically this would be used to be put a small in-memory cache
in front of a slower on-disk cache.
Fixes#111
This uses the official Go SDK from Amazon, which supports the newer v4
authentication method. Fixes#74. Doing so also required adding a new
s3cache package which uses the official SDK.
THIS IS A BREAKING CHANGE for anyone that uses s3, since the syntax of
the command line flag is now different. This is unfortunately necessary
because aws-sdk-go always requires the region to be explicitly declared,
which wasn't always the case with the previous format. This breaking
change is unfortunate, but given that the other s3 package hasn't seen
updates in years, and so many new S3 regions only support the newer v4
authentication method, it's necessary.
Adds a -timeout flag for specifying the timeout. Currently, this
returns a 503 response on timeout, though it should really be a 504,
since imageproxy is acting as a gateway.
Ref: #75
this flag was never actually doing what I thought it was in the first
place.
Also fix up a few instances of cacheDir still be used in config files
fixes#45
The imageproxy command no longer uses the in-memory cache by default.
Instead, no caching is enabled by default and the in-memory cache can be
enabled by passing `-cache memory`.
The -cache flag also supports specifying directories, and therefore
replaces hte older -cacheDir flag. cacheDir is still supported for
compatibility, but is deprecated and will be removed in the future.
This also sets us up to add support for additional caching backends in
the future.
Partial fix for #49.