I have Cloudfront in front of S3 serving images (png and jpg). I have all png and jpg images in webp format in the same directory with .webp extension. For example:
- png: /path/to/file.png
- webp: /path/to/file.png.webp
I'd like to serve the webp file dynamically without changing the markup. Since browsers flag webp support via Accept header, what i need to do is: if the user has support for webp (via Accept header) Cloudfront would pull the webp version (filename.png.webp), if not it should serve the original file (filename.png)
Is this possible to achieve?