mirror of
https://github.com/willnorris/imageproxy.git
synced 2026-04-25 04:46:24 +02:00
README,docs: format and update URLs
Format docs with prettier. Update godoc.org URLs to pkg.go.dev.
This commit is contained in:
parent
7502adde1c
commit
8170536e41
5 changed files with 313 additions and 265 deletions
|
|
@ -41,7 +41,7 @@ list of parameters, which can be supplied in any order. Duplicate parameters
|
|||
overwrite previous values.
|
||||
|
||||
See the full list of available options at
|
||||
<https://godoc.org/willnorris.com/go/imageproxy#ParseOptions>.
|
||||
<https://pkg.go.dev/willnorris.com/go/imageproxy#ParseOptions>.
|
||||
|
||||
### Remote URL
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ source image][small-things], which measures 1024 by 678 pixels.
|
|||
| 200x,png | 200px wide, converted to PNG format | <a href="https://willnorris.com/api/imageproxy/200x,png/https://willnorris.com/images/imageproxy/small-things.jpg"><img src="https://willnorris.com/api/imageproxy/200x,png/https://willnorris.com/images/imageproxy/small-things.jpg" alt="200x,png"></a> |
|
||||
| cx175,cw400,ch300,100x | crop to 400x300px starting at (175,0), scale to 100px wide | <a href="https://willnorris.com/api/imageproxy/cx175,cw400,ch300,100x/https://willnorris.com/images/imageproxy/small-things.jpg"><img src="https://willnorris.com/api/imageproxy/cx175,cw400,ch300,100x/https://willnorris.com/images/imageproxy/small-things.jpg" alt="cx175,cw400,ch300,100x"></a> |
|
||||
|
||||
The [smart crop feature](https://godoc.org/willnorris.com/go/imageproxy#hdr-Smart_Crop)
|
||||
The [smart crop feature](https://pkg.go.dev/willnorris.com/go/imageproxy#hdr-Smart_Crop-ParseOptions)
|
||||
can best be seen by comparing crops of [this source image][judah-sheets], with
|
||||
and without smart crop enabled.
|
||||
|
||||
|
|
@ -182,7 +182,7 @@ first check an in-memory cache for an image, followed by a gcs bucket:
|
|||
|
||||
imageproxy -cache memory -cache gcs://my-bucket/
|
||||
|
||||
[tiered fashion]: https://godoc.org/github.com/die-net/lrucache/twotier
|
||||
[tiered fashion]: https://pkg.go.dev/github.com/die-net/lrucache/twotier
|
||||
|
||||
#### Cache Duration
|
||||
|
||||
|
|
@ -263,7 +263,7 @@ Reload the [codercat URL][], and you should see an error message. Now load a
|
|||
that it loads properly.
|
||||
|
||||
[signed codercat URL]: http://localhost:8080/500,sXyMwWKIC5JPCtlYOQ2f4yMBTqpjtUsfI67Sp7huXIYY=/https://octodex.github.com/images/codercat.jpg
|
||||
[signature option]: https://godoc.org/willnorris.com/go/imageproxy#hdr-Signature
|
||||
[signature option]: https://pkg.go.dev/willnorris.com/go/imageproxy#hdr-Signature-ParseOptions
|
||||
|
||||
Some simple code samples for generating signatures in various languages can be
|
||||
found in [docs/url-signing.md](/docs/url-signing.md). Multiple valid signature
|
||||
|
|
|
|||
|
|
@ -6,12 +6,15 @@ This file contains all notable changes to
|
|||
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
[Unreleased]: https://github.com/willnorris/imageproxy/compare/v0.9.0...HEAD
|
||||
|
||||
## [0.10.0] (2020-04-02)
|
||||
|
||||
[0.10.0]: https://github.com/willnorris/imageproxy/compare/v0.9.0...v0.10.0
|
||||
|
||||
### Added
|
||||
|
||||
- add support for multiple signature keys to support key rotation
|
||||
([ef09c1b](https://github.com/willnorris/imageproxy/commit/ef09c1b),
|
||||
[#209](https://github.com/willnorris/imageproxy/pull/209),
|
||||
|
|
@ -23,6 +26,7 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|||
[benhaan](https://github.com/benhaan))
|
||||
|
||||
### Fixed
|
||||
|
||||
- improved content type detection for some hosts, particularly S3
|
||||
([ea95ad9](https://github.com/willnorris/imageproxy/commit/ea95ad9),
|
||||
[shahan312](https://github.com/shahan312))
|
||||
|
|
@ -34,9 +38,11 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|||
[fieldistor](https://github.com/fieldistor) for the suggested fix)
|
||||
|
||||
## [0.9.0] (2019-06-10)
|
||||
|
||||
[0.9.0]: https://github.com/willnorris/imageproxy/compare/v0.8.0...v0.9.0
|
||||
|
||||
### Added
|
||||
|
||||
- allow request signatures to cover options
|
||||
([#145](https://github.com/willnorris/imageproxy/issues/145))
|
||||
- add simple imageproxy-sign tool for calculating signatures
|
||||
|
|
@ -50,6 +56,7 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|||
([d4ba520](https://github.com/willnorris/imageproxy/commit/d4ba520))
|
||||
|
||||
### Changed
|
||||
|
||||
- improvements to docker image: run as non-privileged user, use go1.12
|
||||
compiler, and build imageproxy as a go module.
|
||||
|
||||
|
|
@ -64,6 +71,7 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|||
otherwise expired.
|
||||
|
||||
### Fixed
|
||||
|
||||
- properly include Accept header on remote URL requests
|
||||
([#165](https://github.com/willnorris/imageproxy/issues/165),
|
||||
[6aca1e0](https://github.com/willnorris/imageproxy/commit/6aca1e0))
|
||||
|
|
@ -71,13 +79,16 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|||
([cf54b2c](https://github.com/willnorris/imageproxy/commit/cf54b2c))
|
||||
|
||||
### Removed
|
||||
|
||||
- removed deprecated `whitelist` flag and `Proxy.Whitelist` struct field. Use
|
||||
`allowHosts` and `Proxy.AllowHosts` instead.
|
||||
|
||||
## [0.8.0] (2019-03-21)
|
||||
|
||||
[0.8.0]: https://github.com/willnorris/imageproxy/compare/v0.7.0...v0.8.0
|
||||
|
||||
### Added
|
||||
|
||||
- added support for restricting proxied URLs [based on Content-Type
|
||||
headers](https://github.com/willnorris/imageproxy#allowed-content-type-list)
|
||||
([#141](https://github.com/willnorris/imageproxy/pull/141),
|
||||
|
|
@ -101,23 +112,28 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|||
as a module will be the only supported method of building imageproxy.
|
||||
|
||||
### Changed
|
||||
|
||||
- when a remote URL is denied, return a generic error message that does not specify exactly why it failed
|
||||
([7e19b5c](https://github.com/willnorris/imageproxy/commit/7e19b5c))
|
||||
|
||||
### Deprecated
|
||||
|
||||
- `whitelist` flag and `Proxy.Whitelist` struct field renamed to `allowHosts`
|
||||
and `Proxy.AllowHosts`. Old values are still supported, but will be removed
|
||||
in a future release.
|
||||
|
||||
### Fixed
|
||||
|
||||
- fixed tcp_mem resource leak on 304 responses
|
||||
([#153](https://github.com/willnorris/imageproxy/pull/153),
|
||||
[Micr0mega](https://github.com/Micr0mega))
|
||||
|
||||
## [0.7.0] (2018-02-06)
|
||||
|
||||
[0.7.0]: https://github.com/willnorris/imageproxy/compare/v0.6.0...v0.7.0
|
||||
|
||||
### Added
|
||||
|
||||
- added support for arbitrary [rectangular crops](https://godoc.org/willnorris.com/go/imageproxy#hdr-Rectangle_Crop)
|
||||
([#90](https://github.com/willnorris/imageproxy/pull/90),
|
||||
[maciejtarnowski](https://github.com/maciejtarnowski))
|
||||
|
|
@ -144,6 +160,7 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|||
[afbd254](https://github.com/willnorris/imageproxy/commit/afbd254))
|
||||
|
||||
### Changed
|
||||
|
||||
- rotate values are normalized, such that `r-90` is the same as `r270`
|
||||
([07c54b4](https://github.com/willnorris/imageproxy/commit/07c54b4))
|
||||
- now return `200 OK` response for requests to root `/`
|
||||
|
|
@ -161,9 +178,11 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|||
[matematik7](https://github.com/matematik7))
|
||||
|
||||
### Removed
|
||||
|
||||
- removed deprecated `cacheDir` and `cacheSize` flags
|
||||
|
||||
### Fixed
|
||||
|
||||
- fixed interpretation of `Last-Modified` and `If-Modified-Since` headers
|
||||
([#108](https://github.com/willnorris/imageproxy/pull/108),
|
||||
[jamesreggio](https://github.com/jamesreggio))
|
||||
|
|
@ -171,9 +190,11 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|||
([#115](https://github.com/willnorris/imageproxy/issues/115))
|
||||
|
||||
## [0.6.0] (2017-08-29)
|
||||
|
||||
[0.6.0]: https://github.com/willnorris/imageproxy/compare/v0.5.1...v0.6.0
|
||||
|
||||
### Added
|
||||
|
||||
- added health check endpoint
|
||||
([#54](https://github.com/willnorris/imageproxy/pull/54),
|
||||
[immunda](https://github.com/immunda))
|
||||
|
|
@ -191,6 +212,7 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|||
[romdim](https://github.com/romdim))
|
||||
|
||||
### Fixed
|
||||
|
||||
- improved error messages for some authorization failures
|
||||
([27d5378](https://github.com/willnorris/imageproxy/commit/27d5378))
|
||||
- skip transformation when not needed
|
||||
|
|
@ -200,16 +222,20 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|||
[b61992e](https://github.com/willnorris/imageproxy/commit/b61992e))
|
||||
|
||||
## [0.5.1] (2015-12-07)
|
||||
|
||||
[0.5.1]: https://github.com/willnorris/imageproxy/compare/v0.5.0...v0.5.1
|
||||
|
||||
### Fixed
|
||||
|
||||
- fixed bug in gif resizing
|
||||
([gifresize@104a7cd](https://github.com/willnorris/gifresize/commit/104a7cd))
|
||||
|
||||
## [0.5.0] (2015-12-07)
|
||||
|
||||
[0.5.0]: https://github.com/willnorris/imageproxy/compare/v0.4.0...v0.5.0
|
||||
|
||||
## Added
|
||||
|
||||
- added Dockerfile
|
||||
([#29](https://github.com/willnorris/imageproxy/pull/29),
|
||||
[sevki](https://github.com/sevki))
|
||||
|
|
@ -227,30 +253,37 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|||
[victortrac](https://github.com/victortrac))
|
||||
|
||||
## Changed
|
||||
|
||||
- change default cache to none, and add `-cache` flag for specifying caches.
|
||||
This deprecates the `-cacheDir` flag.
|
||||
- on-disk cache now stores files in a two-level trie. For example, for a file
|
||||
named "c0ffee", store file as "c0/ff/c0ffee".
|
||||
|
||||
## Fixed
|
||||
|
||||
- skip resizing if requested dimensions larger than original
|
||||
([#46](https://github.com/willnorris/imageproxy/pull/46),
|
||||
[orian](https://github.com/orian))
|
||||
|
||||
## [0.4.0] (2015-05-21)
|
||||
|
||||
[0.4.0]: https://github.com/willnorris/imageproxy/compare/v0.3.0...v0.4.0
|
||||
|
||||
### Added
|
||||
|
||||
- added support for animated gifs
|
||||
([#23](https://github.com/willnorris/imageproxy/issues/23))
|
||||
|
||||
### Changed
|
||||
|
||||
- non-200 responses from remote servers are proxied as-is
|
||||
|
||||
## [0.3.0] (2015-12-07)
|
||||
|
||||
[0.3.0]: https://github.com/willnorris/imageproxy/compare/v0.2.3...v0.3.0
|
||||
|
||||
### Added
|
||||
|
||||
- added support for signing requests using a sha-256 HMAC.
|
||||
([a9efefc](https://github.com/willnorris/imageproxy/commit/a9efefc))
|
||||
- more complete logging of requests and whether response is from the cache
|
||||
|
|
@ -260,38 +293,48 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|||
([#15](https://github.com/willnorris/imageproxy/issues/15))
|
||||
|
||||
### Fixed
|
||||
|
||||
- be more precise in copying over all headers from remote image response
|
||||
([1bf0515](https://github.com/willnorris/imageproxy/commit/1bf0515))
|
||||
|
||||
## [0.2.3] (2015-02-20)
|
||||
|
||||
[0.2.3]: https://github.com/willnorris/imageproxy/compare/v0.2.2...v0.2.3
|
||||
|
||||
### Added
|
||||
|
||||
- added quality option
|
||||
([#13](https://github.com/willnorris/imageproxy/pull/13)
|
||||
[cubabit](https://github.com/cubabit))
|
||||
|
||||
## [0.2.2] (2014-12-08)
|
||||
|
||||
[0.2.2]: https://github.com/willnorris/imageproxy/compare/v0.2.1...v0.2.2
|
||||
|
||||
### Added
|
||||
|
||||
- added `cacheSize` flag to command line
|
||||
|
||||
### Changed
|
||||
|
||||
- improved documentation and error messages
|
||||
- negative width or height transformation values interpreted as 0
|
||||
|
||||
## [0.2.1] (2014-08-13)
|
||||
|
||||
[0.2.1]: https://github.com/willnorris/imageproxy/compare/v0.2.0...v0.2.1
|
||||
|
||||
### Changed
|
||||
|
||||
- restructured package so that the command line tools is now installed from
|
||||
`willnorris.com/go/imageproxy/cmd/imageproxy`
|
||||
|
||||
## [0.2.0] (2014-07-02)
|
||||
|
||||
[0.2.0]: https://github.com/willnorris/imageproxy/compare/v0.1.0...v0.2.0
|
||||
|
||||
### Added
|
||||
|
||||
- transformed images are cached in addition to the original image
|
||||
([#1](https://github.com/willnorris/imageproxy/issues/1))
|
||||
- support etag and last-modified headers on incoming requests
|
||||
|
|
@ -299,13 +342,16 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|||
- support wildcards in list of allowed hosts
|
||||
|
||||
### Changed
|
||||
|
||||
- options can be specified in any order
|
||||
- images cannot be resized larger than their original dimensions
|
||||
|
||||
## [0.1.0] (2013-12-26)
|
||||
|
||||
[0.1.0]: https://github.com/willnorris/imageproxy/compare/5d75e8a...v0.1.0
|
||||
|
||||
Initial release. Supported transformation options include:
|
||||
|
||||
- width and height
|
||||
- different crop modes
|
||||
- rotation (in 90 degree increments)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ eventually relent, and
|
|||
[#49](https://github.com/willnorris/imageproxy/issues/49) tracked adding
|
||||
support for the most common backends.
|
||||
|
||||
Unfortunately my concerns proved true, and build times are *significantly*
|
||||
Unfortunately my concerns proved true, and build times are _significantly_
|
||||
slower (TODO: add concrete numbers) now because of all the additional cloud
|
||||
SDKs that get compiled in. I don't personally care too much about binary size,
|
||||
since I'm not running in a constrained environment, but these build times are
|
||||
|
|
@ -40,11 +40,12 @@ back out.
|
|||
### Plugin support in Go
|
||||
|
||||
TODO: talk about options like
|
||||
- RPC (https://github.com/hashicorp/go-plugin)
|
||||
- pkg/plugin (https://golang.org/pkg/plugin/)
|
||||
- embedded interpreter (https://github.com/robertkrimen/otto)
|
||||
- custom binaries (https://github.com/mholt/caddy,
|
||||
https://caddy.community/t/59)
|
||||
|
||||
- RPC (<https://github.com/hashicorp/go-plugin>)
|
||||
- pkg/plugin (<https://golang.org/pkg/plugin/>)
|
||||
- embedded interpreter (<https://github.com/robertkrimen/otto>)
|
||||
- custom binaries (<https://github.com/mholt/caddy>,
|
||||
<https://caddy.community/t/59>)
|
||||
|
||||
Spoiler: I'm planning on following the Caddy approach and using custom
|
||||
binaries.
|
||||
|
|
@ -60,6 +61,7 @@ much about personally. Of course, users can also write their own plugins and
|
|||
link them in without needing to contribute them to core if they don't want to.
|
||||
|
||||
I anticipate providing two or three build configurations in core:
|
||||
|
||||
- **full** - include all the plugins that are part of core (except where they
|
||||
may conflict)
|
||||
- **minimal** - some set of minimal features that only includes basic caching
|
||||
|
|
|
|||
|
|
@ -19,14 +19,14 @@ Signatures can be calculated in two ways:
|
|||
In both cases, the signature is calculated using HMAC-SHA256 and a secret key
|
||||
which is provided to imageproxy on startup. The message to be signed is the
|
||||
remote URL, with the transformation options optionally set as the URL fragment,
|
||||
[as documented below](#Signing-options). The signature is url-safe base64
|
||||
[as documented below](#signing-options). The signature is url-safe base64
|
||||
encoded, and [provided as an option][s-option] in the imageproxy request.
|
||||
|
||||
imageproxy will accept signatures for URLs with or without options
|
||||
transparently. It's up to the publisher of the signed URLs to decide which
|
||||
method they use to generate the URL.
|
||||
|
||||
[s-option]: https://godoc.org/willnorris.com/go/imageproxy#hdr-Signature
|
||||
[s-option]: https://pkg.go.dev/willnorris.com/go/imageproxy#hdr-Signature-ParseOptions
|
||||
|
||||
## Signing options
|
||||
|
||||
|
|
@ -57,9 +57,8 @@ the signed value would be:
|
|||
The `100` size option was put in its canonical form of `100x100`, and the
|
||||
options are sorted, moving `q75` before `r90`.
|
||||
|
||||
[ParseOptions]: https://godoc.org/willnorris.com/go/imageproxy#ParseOptions
|
||||
[size option]: https://godoc.org/willnorris.com/go/imageproxy#hdr-Size_and_Cropping
|
||||
|
||||
[ParseOptions]: https://pkg.go.dev/willnorris.com/go/imageproxy#ParseOptions
|
||||
[size option]: https://pkg.go.dev/willnorris.com/go/imageproxy#hdr-Size_and_Cropping-ParseOptions
|
||||
|
||||
## Signed options example
|
||||
|
||||
|
|
@ -76,8 +75,6 @@ and our resulting signed key is `0sR2kjyfiF1RQRj4Jm2fFa3_6SDFqdAaDEmy1oD2U-4=`
|
|||
The final url would be
|
||||
`http://localhost:8080/400x400,q40,s0sR2kjyfiF1RQRj4Jm2fFa3_6SDFqdAaDEmy1oD2U-4=/https://octodex.github.com/images/codercat.jpg`
|
||||
|
||||
|
||||
|
||||
## Language Examples
|
||||
|
||||
Here are examples of calculating signatures in a variety of languages. These
|
||||
|
|
@ -90,6 +87,7 @@ See also the [imageproxy-sign tool](/cmd/imageproxy-sign).
|
|||
### Go
|
||||
|
||||
main.go:
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
|
|
@ -180,38 +178,40 @@ url = sys.argv[2]
|
|||
print base64.urlsafe_b64encode(hmac.new(key, msg=url, digestmod=hashlib.sha256).digest())
|
||||
```
|
||||
|
||||
````shell
|
||||
```shell
|
||||
$ python sign.py "secretkey" "https://octodex.github.com/images/codercat.jpg"
|
||||
cw34eyalj8YvpLpETxSIxv2k8QkLel2UAR5Cku2FzGM=
|
||||
````
|
||||
```
|
||||
|
||||
### JavaScript
|
||||
|
||||
```javascript
|
||||
const crypto = require('crypto');
|
||||
const URLSafeBase64 = require('urlsafe-base64');
|
||||
const crypto = require("crypto");
|
||||
const URLSafeBase64 = require("urlsafe-base64");
|
||||
|
||||
let key = process.argv[2];
|
||||
let url = process.argv[3];
|
||||
console.log(URLSafeBase64.encode(crypto.createHmac('sha256', key).update(url).digest()));
|
||||
console.log(
|
||||
URLSafeBase64.encode(crypto.createHmac("sha256", key).update(url).digest()),
|
||||
);
|
||||
```
|
||||
|
||||
````shell
|
||||
```shell
|
||||
$ node sign.js "secretkey" "https://octodex.github.com/images/codercat.jpg"
|
||||
cw34eyalj8YvpLpETxSIxv2k8QkLel2UAR5Cku2FzGM=
|
||||
````
|
||||
```
|
||||
|
||||
### PHP
|
||||
|
||||
````php
|
||||
```php
|
||||
<?php
|
||||
|
||||
$key = $argv[1];
|
||||
$url = $argv[2];
|
||||
echo strtr(base64_encode(hash_hmac('sha256', $url, $key, 1)), '/+' , '_-');
|
||||
````
|
||||
```
|
||||
|
||||
````shell
|
||||
```shell
|
||||
$ php sign.php "secretkey" "https://octodex.github.com/images/codercat.jpg"
|
||||
cw34eyalj8YvpLpETxSIxv2k8QkLel2UAR5Cku2FzGM=
|
||||
````
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue