Hello,
Many of the sites we have on CloudFlare (FREE plan) serve WEBP images which fallback to their original format if WEBP is not supported. This is done using the following htaccess rules:
RewriteCond %{HTTP_ACCEPT} !image/webp [OR]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}/$1$2$3/$4.jpg -f
RewriteRule ^(.*?)(site/assets/files/)([0-9]+)/(.*)\.webp(.*)$ /$1$2$3/$4.jpg [R=307,L]
RewriteCond %{HTTP_ACCEPT} !image/webp [OR]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}/$1$2$3/$4.jpeg -f
RewriteRule ^(.*?)(site/assets/files/)([0-9]+)/(.*)\.webp(.*)$ /$1$2$3/$4.jpeg [R=307,L]
RewriteCond %{HTTP_ACCEPT} !image/webp [OR]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}/$1$2$3/$4.png -f
RewriteRule ^(.*?)(site/assets/files/)([0-9]+)/(.*)\.webp(.*)$ /$1$2$3/$4.png [R=307,L]
I added a new site yesterday and it was working fine. Indeed, I’ve not noticed an issue before with any sites, some which have been using WEBP for months.
However, this morning when I checked the new site, none of the images were loading for browsers that do not support WEBP. I found that if I appended a cache buster string (e.g. ?nc=12345678), the fallback image was served correctly, but the cached one was not working. Purging the cache for the site resolved the problem - temporarily. The corrupted/missing images have returned after a few hours (probably 4 as per setting).
Why would this suddenly just stop working? Could it be related to the Network Performance issues on 23/4/20?
What could be causing it? I haven’t changed any settings from when it was working to now. Perhaps a change on CloudFlare’s end is stopping the htaccess redirect/fallback from working now?
Cheers,
Chris Thomson