I have used the following in the past to serve fall back webp images,
but now my sites when I curl and image respond back with NGINX which means that apache is never seeing this
is there a way to have nginx fall back to webp images.
I have done some searches on google but most of the things dont work, adding anything with location into the field seems to fail everytime
location ~* "^(?<path>.+)\.(png|jpeg|jpg|gif)$" {
try_files $path$webp_ext $path$file_ext =404;
}
does anyone know how this is done?
Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{REQUEST_URI} (?i)(.*)(\.jpe?g|\.png)$
RewriteCond %{DOCUMENT_ROOT}%1.webp -f
RewriteRule (?i)(.*)(\.jpe?g|\.png)$ %1\.webp [L,T=image/webp,R]
</IfModule>
<IfModule mod_headers.c>
Header append Vary Accept env=REDIRECT_accept
</IfModule>
AddType image/webp .webp
but now my sites when I curl and image respond back with NGINX which means that apache is never seeing this
is there a way to have nginx fall back to webp images.
I have done some searches on google but most of the things dont work, adding anything with location into the field seems to fail everytime
location ~* "^(?<path>.+)\.(png|jpeg|jpg|gif)$" {
try_files $path$webp_ext $path$file_ext =404;
}
does anyone know how this is done?