How it works
Resizer uses libvips for image processing and Cloudflare Workers to handle requests.
When a request is made, Resizer checks if the image is in the cache:
- Cache Hit: The image is served directly from the cache.
- Cache Miss: If the image is not cached or the cache has expired, Resizer processes the image and stores it in the cache for future requests.
The original image URL is not stored. The image must remain accessible at the provided URL for Resizer to process it.
Caching Behavior
On the Server
- Images are cached for 30 days by default.
- Cloudflare may remove cached images based on usage frequency.
- The cache status can be checked using the CF-Cache-Status header:
HIT
: Served from the cache.MISS
orEXPIRED
: Reprocessed and cached.
- For more details, refer to Cloudflare’s Tiered Cache documentation.
On the Browser
- By default, the response includes a
Max-Age
header, allowing the browser to cache the image for 30 days. - You can customize this duration using the
maxage
parameter.
For high availability and performance, consider pre-processing images.