Is there something similar to Diagnostic Center | Check SSL and Test Website Security | Cloudflare
just for images to test specifically if webp is working?
I’d probably just use cURL.
➜ ~ curl https://static.haydenjames.io/wp-content/uploads/2019/07/Datadog-APM-_-Datadog.png --header 'Accept: image/avif,image/webp,*/*' -sSI | grep 'content-type'
content-type: image/webp
Seems to work for me.
HTTP/2 200
date: Mon, 09 May 2022 16:54:48 GMT
content-type: image/webp
content-length: 122216
cache-control: public, max-age=31919000
cf-bgj: imgq:100,h2pri
cf-polished: origFmt=png, origSize=162936
Polish will perform content negotiation with the browser (or whatever tool loads it) - hence why I included the Accept
header. Not all browsers support AVIF or WEBP and if they don’t send it in the Accept
header then they wouldn’t get WEBP back.
Strange. That one image started to work yes. But all the others on that page are still .png:
(last column on the right)
You’re likely hitting cached images.
Images in the cache must be purged or expired before seeing any changes in Polish settings.
After force reloading the site, any PNG/JPEG turned into WEBP.
Ok thanks will try to clear.
Should probably clarify - cache is referring to Cloudflare’s cache.
From origin (EXPIRED).
From Cloudflare (HIT).
You might want to increase the Edge Cache TTL on your Page Rule to maximize their lifetime in the cache.
Ok just did that:
Polish will also pass the original format on first request. This is because Polish intends to get the image to the user as quickly as possible, so on first request it gives the user the image that it has, and queues the conversion to happen in the background.
Below are two requests I made for that image a few seconds apart where this behaviour can be seen:
% curl "https://static.haydenjames.io/wp-content/uploads/2019/07/Datadog-APM-_-Datadog.png?community=1" --header 'Accept: image/webp'
content-type: image/png
cf-cache-status: MISS
% curl "https://static.haydenjames.io/wp-content/uploads/2019/07/Datadog-APM-_-Datadog.png?community=1" --header 'Accept: image/webp'
content-type: image/webp
cf-bgj: imgq:100,h2pri
cf-polished: origFmt=png, origSize=162936
cf-cache-status: HIT
Thanks for added info. That took me several tries before a cache hit :
So from what I’m gathering, I should stop clearing cache in an effort to serve webp images because the cache requires several misses before caching images and serving as webp.
If I don’t purge, in a few hours or so, most of the files should eventually return webp after they are eligible for CF storage?
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.