Traditional image optimization often happens at the origin server—resizing uploads, generating thumbnails, and converting formats during content creation. This approach creates storage overhead, complicates development workflows, and delivers static assets that can't adapt to different devices or network conditions. Edge-based image proxies flip this model by processing images on-demand at CDN locations worldwide, transforming them dynamically based on URL parameters and client capabilities. This article guides you through implementing an image proxy setup that handles resizing, format conversion, and compression at the edge, reducing origin load while accelerating delivery.
How Edge Image Proxes Work
Edge image proxies intercept requests for images, parse transformation parameters from the URL or headers, process the image at the CDN edge location, and serve the optimized result. The first request fetches the original image from your origin and applies transformations, while subsequent requests serve the processed version from edge cache.
- 1Request InterceptionCDN intercepts image request containing transformation parameters
- 2Cache CheckChecks if transformed version exists in edge cache
- 3Origin FetchIf not cached, fetches original image from origin server
- 4TransformationApplies resizing, format conversion, compression at edge
- 5Cache StorageStores optimized version in edge cache for future requests
- 6DeliveryServes optimized image to client with appropriate headers
Common Transformation Parameters
Image proxies typically use URL parameters to specify transformations. While implementations vary, most support similar parameters for controlling size, format, quality, and other processing options.
- width / w
- Target width in pixels (maintains aspect ratio if height not specified)
- height / h
- Target height in pixels
- quality / q
- Compression quality (0-100), often with smart defaults per format
- format / fm
- Output format (jpg, png, webp, avif, auto)
- crop
- Cropping mode (fit, fill, crop, scale, smart)
- rotate
- Rotation angle in degrees
Implementation Approaches
You can implement edge image processing through various approaches, from managed services to self-hosted solutions. Each option has different tradeoffs in terms of control, cost, and maintenance overhead.
- ProsQuick setup, no maintenance, global infrastructure
- ConsVendor lock-in, recurring costs, limited customization
- ProsFull control, one-time cost, complete customization
- ConsMaintenance overhead, scaling challenges, infrastructure costs
Configuration Best Practices
Proper configuration ensures your image proxy delivers optimal performance while preventing abuse and managing costs effectively. These practices apply regardless of your chosen implementation approach.
- Implement caching headers
- Set reasonable size limits
- Enable automatic format negotiation
- Configure quality defaults per format
- Set up monitoring and analytics
- Implement rate limiting
- Use signed URLs for sensitive content
Advanced Techniques
Beyond basic resizing and format conversion, advanced proxy configurations can handle responsive images, automatic optimization, and intelligent cropping.
Testing and Monitoring
After implementing your image proxy, thorough testing ensures it performs correctly across various scenarios. Monitor key metrics to identify issues and optimize performance over time.
- 1Test format supportVerify WebP/AVIF serve correctly to supported browsers with proper fallbacks for others
- 2Check responsive behaviorTest different viewports and devices to ensure appropriate sizes are delivered
- 3Verify caching headersConfirm Cache-Control, ETag, and Last-Modified headers are set correctly
- 4Monitor origin requestsEnsure only missing transformations trigger origin fetches, not every request
- 5Track performance metricsMonitor LCP improvements, bandwidth savings, and transformation latency
Automate image optimization with Optimagio
Doing this by hand for every image does not scale. Optimagio optimizes and converts your images (WebP and AVIF) automatically across your API, web app, and CMS — so every page ships the smallest possible files without manual work. See plans and pricing →