No description
cache | ||
.gitignore | ||
config.example.json | ||
go.mod | ||
go.sum | ||
handler.go | ||
LICENSE | ||
main.go | ||
README.md |
image-proxy
An image proxy server that resizes images before serving them. Intended to only be used with images that already have a consistent size (such as already processed avatars).
Configuration
Configuration is done in a config.json
file, with the following keys:
port
: the port the server will listen ondebug
: whether the server will log all request paths and durationsproxy_target
: the target for the reverse proxy, used when the requested size is the image's actual size. Should be the full base URL of the target server, without a trailing slash.patterns
: an array of patterns to acceptinput
: (string) the input regex. This should start with a/
and use unnamed capture groups.output
: (string) the URL to rewrite the link to, using$1
$2
(etc) as placeholders for the capture groups.cache_key
: (string) the file name used for cached files. Must be unique across all patterns.content_type
: (string) theContent-Type
header to return with requests.sizes
: (array of numbers) the acceptable sizes for this pattern. The first size in the list is the default, and will be passed through unmodified.
To-do list
- Clean up old, unused cache entries