Proxies and manipulates images, allowing user embedded content to be served from a single secure host at various sizes.
As proxy
Pass the remote image url to your front deployment as a url param. For example, to proxy an insecure gopher http://golang.org/doc/gopher/frontpage.png
:
https://go-front.herokuapp.com/?url=http://golang.org/doc/gopher/frontpage.png
To resize images
Add width and height params to the standard proxy url. For example, for a smaller gopher:
https://go-front.herokuapp.com/?url=http://golang.org/doc/gopher/frontpage.png&width=125&height=175
The simplest method is to deploy on heroku:
You'll probably want to add a CDN (e.g. CloudFront) to your front deployment for caching
Config is via environment variables:
variable | description | optional |
---|---|---|
PORT | The port to listen on | no, though automatically set on heroku |
ALLOWED_CONTENT_TYPE_REGEX | Regex the upstream Content-Type must match in order to be proxied | yes, defaults to ^image/ |