Signed URLs, so nobody mints sizes on your bill
Without signing, anyone who finds your image host can ask for new sizes and filters, and each new one counts as a transformation. Give a source a secret and only URLs your app signs will render. Signed URLs are on Hobby and above.
How it works
Add a secret to the source
Set it in the dashboard. Sources without a secret stay open.
Sign the path in your app
The token is the hex HMAC SHA-256 of the path, from the first slash after the host.
We check every request
A missing, wrong or expired token gets 403 Forbidden. Tokens are compared in constant time.
The token
# path = everything after the host, starting with /
token = hex(HMAC-SHA256(secret, path))
https://img.imagefoundry.io/acme/width/400/photo.jpg?token=<token>
# With an expiry (Unix time, seconds), sign the path plus ?expires=
token = hex(HMAC-SHA256(secret, path + "?expires=" + expires))
https://img.imagefoundry.io/acme/width/400/photo.jpg?expires=1767225600&token=<token>In your language
// Node.js
const token = crypto.createHmac('sha256', secret).update(path).digest('hex');
# Python
token = hmac.new(secret.encode(), path.encode(), hashlib.sha256).hexdigest()
// PHP
$token = hash_hmac('sha256', $path, $secret);Token parameter names
Signed links from other services keep working if they use the same scheme.
| Parameter | Used by |
|---|---|
| token | Image Foundry |
| bossToken | ImageBoss |
| s | imgix |
Related
Try it on one picture.
Free for 1,000 transformations a month. No card needed to start.