I am using the following, trying to serve webp images from Magento using Nginx and Varnish as caching.
Added to /etc/nginx/mime.types
image/webp webp;
Added to main nginx.conf
http {
map $http_accept $webp_suffix {
default "";
"~*webp" ".webp";
}
}
Added to my-site.conf for Magento 2 server block
location /media/ {
try_files $uri $uri/ /get.php?$args;
location ~ ^/media/theme_customization/.*\.xml {
deny all;
}
location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2|webp)$ {
add_header Cache-Control "public";
add_header X-Frame-Options "SAMEORIGIN";
expires +1y;
try_files $uri$webp_suffix $uri$webp_suffix/ /get.php?$args;
}
But I still get jpg images instead of webp. What am I doing wrong?
.webp
version?