I’m trying to make a rewrite rule that detects if browser support webp. I saw this topic Automatically serve webp if browser supports it and tried this conf as well:
rewrite {
if {>Accept} has image/webp
r ^(.+)\.(jpg|jpeg|png)$
to {1}.webp {path} {path}/
}
header / Vary Accept
But seem it doesn’t work as I exptected. There are no any changes on my page.
I serve static files on aws s3, so on my page I have urls like:
https://subdomain123.cloudfront.net/media/img_name.png
I’d like to detect if client’s browser support webp and if so rewrite url to:
https://subdomain123.cloudfront.net/media/img_name.webp
Could you please tell me is it possible and give me example of how to do it. Thank you