Images not showing and reappearing after cache purge

Images all over my website started disappearing about a week ago. I tested turning on and off plugins and emptying caches and narrowed down that Cloudflare has at least some influence: after a full cache purge the images reappeared. But a few days later, they disappeared again…

Rocketloader is disabled in Cloudflare settings. I use a number of tools: auto optimize, wp supercache, redis, gzip compression, cpanel php settings opcache and gmagick. I haven’t made any changes to the settings, the plugins did have some updates I guess.

I have read some threads about redirection of images to the home page. I lack the skills to test if that’s happening…

Would appreciate any help!

That sounds similar to this issue:

Yes it does, I will follow that topic. Your answer there I will check as soon as images start disappearing again, as I just purged cache to at least get them back :slight_smile:

Hey all here’s a screenshot. The website is not pulling a 404 or 403 from the image. Does this help narrow it down?

Thanks for your help!

Tyler

That looks like you’re using WebP, which Safari doesn’t support.

You probably have some optimization plugin that converts images to .webp, but retains the .png extension, as is the norm for the situation. However, Cloudflare will cache the webp image with the .png extension, and when a Safari visitors hits your site, they get the webp cached version of the .png and can’t display it.

2 Likes

Aha!

Thanks for this help - using BulkShortPixel. I removed the WebP image setting and will re-optimize the images and delete the cache.

Thanks again!

I am using Ewww image optimizer plugin and you reminded me I did recently enable WebP image serving. I will disable it to see if the issue is now solved. The plugin does give a notice about possible browser incompatibility and suggests to put this in the htaccess file:

RewriteEngine On RewriteCond %{HTTP_ACCEPT} image/webp RewriteCond %{REQUEST_FILENAME} (.*)\.(jpe?g|png)$ RewriteCond %{REQUEST_FILENAME}\.webp -f RewriteCond %{QUERY_STRING} !type=original RewriteRule (.+)\.(jpe?g|png)$ %{REQUEST_FILENAME}.webp [T=image/webp,E=accept:1,L] Header append Vary Accept env=REDIRECT_accept AddType image/webp .webp

That’s doesn’t help prevent this issue then, Cloudflare serves WebP anyway? Any idea how to make this WebP work with Cloudflare?

Thanks in any case!

Hi @mitch10, just a tip on posting here:

You can edit your post and use the code icon </> to make the .htaccess part of your post legible.

2 Likes

This topic was automatically closed after 30 days. New replies are no longer allowed.