The Vary for images feature is exactly what I need to serve WebP optimized images for modern browsers and JPG for legacy browsers, however the file extension requirement is very awkward to use with frameworks/services that do not have a file extension in its path.
For example, the Next.js framework has a built-in image optimization feature that automatically serves WebP images, but the image URL path is
Because this URL doesn’t have a file extension on the path (only the query parameter), it is not eligible for the vary for images feature.
It would be very helpful if we can possibly provide a custom RegEx rule or path (e.g.
/_next/image) to opt-in the Vary for images instead of file extensions.