Fork of GitHub's camo, but without HMAC signatures and hexencoding urls.
- Max size for proxied images
- Follow redirects to a certain depth
- Restricts proxied images content-types to a whitelist
- Forward images regardless of HTTP status code
- Access-Control-Allow-Origin: *
Camo supports two URL formats:
http://example.org/camo?url=<image-url>
http://example.org/camo/<image-url>
Camo is configured through environment variables.
PORT
: The port number Camo should listen on. (default: 8081)CAMO_HEADER_VIA
: The string for Camo to include in theVia
andUser-Agent
headers it sends in requests to origin servers. (default:Camo Asset Proxy <version>
)CAMO_LENGTH_LIMIT
: The maximumContent-Length
Camo will proxy. (default: 5242880)CAMO_LOGGING_ENABLED
: The logging level used for reporting debug or error information. Options aredebug
anddisabled
. (default:disabled
)CAMO_MAX_REDIRECTS
: The maximum number of redirects Camo will follow while fetching an image. (default: 4)CAMO_SOCKET_TIMEOUT
: The maximum number of seconds Camo will wait before giving up on fetching an image. (default: 10)CAMO_TIMING_ALLOW_ORIGIN
: The string for Camo to include in theTiming-Allow-Origin
header it sends in responses to clients. The header is omitted if this environment variable is not set. (default: not set)CAMO_HOSTNAME
: TheCamo-Host
header value that Camo will send. (default:unknown
)CAMO_KEEP_ALIVE
: Whether or not to enable keep-alive session. (default:false
)
% rake bundle
% coffee server.coffee
% rake
To see the full URL restclient is hitting etc, try this.
% RESTCLIENT_LOG=stdout rake
You should run this on heroku.
To enable useful line numbers in stacktraces you probably want to compile the server.coffee file to native javascript when deploying.
% coffee -c server.coffee
% /usr/bin/env PORT=9090 node server.js
A Dockerfile
is included, you can build and run it with:
docker build -t camo .
docker run -t camo