0
Fork 0
mirror of https://github.com/willnorris/imageproxy.git synced 2024-12-16 21:56:43 -05:00
Commit graph

92 commits

Author SHA1 Message Date
Will Norris
a7a04ebe7b simplify copyHeader func
- take simple http.Header values as input, rather than http.Response
- allow multiple headers to be copied to be specified.  If no headers
  specified, then copy all.
2017-06-14 17:22:45 -04:00
Will Norris
c81621ae35 rename check304 to should304
this reads a little better in if blocks
2017-06-14 16:34:34 -04:00
Will Norris
328044540e add webp support (decode only)
if any transformation is requested, webp images will be encoded and
served as jpeg or png, defaulting to jpeg if no format is specified.

Fixes #88
2017-06-01 08:13:33 -07:00
Will Norris
b9cc9df4b6 add support for specifying output image format
For now, the options are "jpeg" and "png".  Gif is a little harder to
support because of the way we use the image/gif package to handle
animated gifs. I have also have trouble imagining someone wanting to use
gif over png. But if the need really exists, we can address it when it
comes up.

Fixes #89
2017-06-01 08:13:11 -07:00
Will Norris
576b7c023a return 504 status for timeout errors
modify custom TimeoutHandler to return 504 error and switch imageproxy
to use that func.

Fixes #75
2016-11-29 15:42:08 -08:00
Will Norris
93166a5b20 add support for per-request timeout
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
2016-11-29 15:42:07 -08:00
xavren
79369ca8ef Copy header Link for canonical image SEO
fix format
2016-06-07 13:50:07 -04:00
Will Norris
a1af9aa8e2 handle 'cleaned' remote URLs
If imageproxy runs behind an http.ServeMux or certain web servers, the
double slash in the remote URL will get collapsed down to a single
slash.  (e.g. http://example.com/ becomes http:/example.com/).  This
is now handled by imageproxy directly.

Ref #65
2016-05-26 13:22:20 -07:00
Phil Howell
1bdb3358b4 Add health-check endpoint 2016-01-12 17:19:27 +00:00
Will Norris
27d53782b4 update allowed func to return error instead of bool
this allows returning a more accurate error message, particularly in the
case of an invalid referer header
2015-12-14 10:18:14 -08:00
Will Norris
b4216d8da8 remove Proxy pointer from TransformingTransport
This pointer was only needed to pass along the scaleUp option.  In order
to prevent someone from specifying the scaleUp option on an individual
request against the owner's wishes, we didn't encode or decode that
field on the Options struct.  Instead, we stored the value on the Proxy
object and then set it on the Options struct inside the
TransformingTransport.  This worked, but I never really liked binding
those two together.

Instead, we now treat scaleUp as a normal Option field, encoding and
decoding it with all the others.  The primary difference is that the
initial value from the request URL will always be overwritten with
whatever is set in Proxy.ScaleUp.  This decouples the
TransformingTransport from the Proxy, but prevents the option from being
set in the request URL.

Modifies #37
2015-12-07 23:06:02 -08:00
Rune Madsen
9a4791d60a adding cache-control header 2015-09-05 10:51:07 -04:00
Connor Peet
9213c93c94 Add ability to restrict http referrer 2015-08-15 10:36:07 -07:00
Rune Madsen
4e60c683b0 scaleup flag 2015-08-12 14:39:38 -04:00
Will Norris
396afb8a87 proxy non-200 responses with original status code
Some sites return a 404 image, and most browsers render them properly.
We should pass them along as well.

see also: atmos/camo#75 and atmos/camo#77
2015-05-15 22:33:03 -07:00
Will Norris
a9efefc8e7 add request signature support to Proxy 2015-05-14 15:30:07 -07:00
Will Norris
9d6f8fdf7d refactor whitelist check in preparation for signature check 2015-05-14 15:30:06 -07:00
Will Norris
b1de3a9dd6 add String method to Request 2015-05-11 17:12:03 -07:00
Will Norris
ad54d71881 first pass at supporting a default base URL
this allows remote images to be specified as relative URLs, relative to
the `DefaultBaseURL` field.  Fixes #15.
2015-04-28 08:25:10 -07:00
Will Norris
dbac2f8063 log transform errors 2015-03-17 23:47:43 -07:00
Will Norris
2b84ef01ed log requests and whether response is from cache
also make sure request body is always closed

fixes #17
2015-02-24 09:34:49 -08:00
Will Norris
1bf0515cef be a little more precise in copying headers
it doesn't matter too much right now, given the headers that are being
copied, but this now makes sure that all header values get copied over
if multiple are present.
2015-02-20 23:52:52 -08:00
Will Norris
bf8d7a0cd8 copy original content-type from remote response 2015-02-20 13:05:31 -08:00
Will Norris
2e68caff67 more docs and rename TransformingTransport.Client 2014-11-26 16:49:48 -08:00
Will Norris
f476aa27c3 ignore favicon requests 2014-11-23 16:04:53 -08:00
Will Norris
2dd79ebd20 minor cleanup of error messages
- used same string for logging and error response to ensure they stay in
  sync
- pass through any http error status codes from remote URLs
2014-11-21 17:59:51 -08:00
Will Norris
5a4e602373 small cleanup of check304 and add more tests
Remove unused ResponseWriter parameter from check304, add function docs,
and add TODO for alternate Etag header values that we should handle.

Add tests for Proxy.allowed and check304.
2014-11-21 07:51:19 -08:00
Will Norris
7994cb2cf6 handle error returned when fetching remote images 2014-11-19 22:22:21 -08:00
Will Norris
dae09a8c9d rename proxy.go and remove old data package doc 2014-11-19 22:02:34 -08:00
Will Norris
a74e590181 restructure imageproxy package
- move binary from imageproxy.go to cmd/imageproxy/main.go
- move proxy package up to top level
2014-07-30 18:23:43 -07:00
Will Norris
919fdfbb78 relocate package to willnorris.com/go/imageproxy 2014-06-29 14:33:56 -07:00
Will Norris
c3eda83ab5 add default VERSION string 2013-12-26 13:55:52 -08:00
Will Norris
462b70dcc2 rename to 'imageproxy' (drop 'go-' prefix) 2013-12-26 11:14:28 -08:00
Will Norris
26dde07ec0 add -version flag and goxc build config 2013-12-26 11:00:50 -08:00
Will Norris
1db6456329 add cacheDir for specifying disk cache dir 2013-12-26 08:31:52 -08:00
Will Norris
73f6357cda rely on httpcache for response caching 2013-12-26 08:31:52 -08:00
Will Norris
ea76f2d0d8 switch to Apache 2.0 license before release 2013-12-06 17:40:35 -08:00
Will Norris
036d0c51c4 allow setting max height and width
This is primarily added to prevent a denial of service attack where
insanely large images are requested, eating up CPU.
2013-12-06 14:17:39 -08:00
Will Norris
402e2c7d83 switch port flag to addr to allow specifying host 2013-12-04 03:58:26 -08:00
Will Norris
deaf0abd50 add whitelist of allowed remote hosts 2013-12-04 03:12:56 -08:00
Will Norris
95fdd8b79f add basic caching support
includes two implementations, a no-op NopCache and an in-memory
MemoryCache.
2013-12-04 02:55:56 -08:00
Will Norris
11441a107a add initial (pretty naive) server implementation 2013-11-27 14:45:46 -08:00