Cloudflare (Polish enabled) serving WEBP to Safari!

I’ve just tracked down a bug that was stopping our app working for some users. We’re serving some PNG files from S3 via Cloudflare. Obviously S3 is just serving the same PNG file no matter what, but we have the “Polish” feature turned on a Cloudflare.

As I understand it that should convert and serve WEBP when supported and PNG when not. However for a couple of PNG images it seems to have decided to always serve them as WEBP for Safari browsers (both mobile and desktop versions). This broke the app as the images couldn’t load.

I’ve disabled WEBP in Polish now but this seems a symptom of a deeper problem. I’m not sure how to contact Cloudflare directly but I hope they check these forums. And if you’re a Cloudflare user it’s probably worth disabling WEBP in Polish now if you care about Safari users!

Do you have an example of the request headers being sent from a Safari browser that had this issue?

1 Like

So, Safari (as of Big Sur aka OSX 11 onwards) does support WebP and will request it via the image/webp value in the Accept request header.

If you enable Polish with WebP support and we have that image cached already, we will send a WebP version to browsers advertising support via the Accept header. That’s what happens with versions of Safari from Big Sur onwards, and it should not be problematic - we serve WebP to clients that ask for it :slight_smile: .

If you’re able to reproduce the error (was it a broken image you saw, or something else?) and can send us a copy of the image and also a HAR file from Safari, that would really help us understand further.

4 Likes

Thanks for your reply! And thanks also for replying on Twitter
(https://twitter.com/almostobsolete/status/1527676099626516480)

So for anyone else following the problem wasn’t that it was serving WebPs as Safari does actually support them now! The problem was that a couple of specific file PNG files produced WebPs that Safari couldn’t display. Here’s an one of them:

WebP is now disable on that domain so you’ll only get the PNG. If I get time I might enable WebP on another test domain and save the produced WebP file.

Is it disabled currently? Could be caching but that PNG is completely blank for me (on iOS Safari).

For me aswell, but for me it indeed is a PNG and I am on Chrome. Fully transparent PNG it seems like.

Sorry for the confusion! Yes that is a fully transparent PNG, it only seems to be effecting fully transparent ones.

Do you have Polish set for webP as lossless or lossy?

@accounts121 - if you could pick an impacted image and set a page rule to enable Polish in Lossy mode - but add a special random value to the query string, you can replicate the issue without impacting your website. Once we have a live reproduction we can dig into this one further.

1 Like

Thanks for sharing the twitter link!

I used page rules to make a test, you can see it here:

https://media.telescape.com/test-cloudflare-issue/test2.html

(NOTE THAT IT’S A TRANSPARENT IMAGE, SO IF IT WORKS YOU SHOULD SEE NOTHING!)

For me on Safari that shows an error placeholder for the image. It works fine on Chrome and Firefox. Interestingly it also works if I open the image directly in Safari rather than using it via an IMG tag, no idea what’s up with that!

So looks like a Safari bug, but one that Cloudflare should really be working around IMO.

Thanks for capturing this. So the reason for the difference there is Safari does not advertise support for image/wep when you request the image directly:

However if you request via the HTML page, it does ask for webp:

This does look like a bug with Safari’s handling of webp, but I will report it internally. For now keep WebP disabled across your website - if you can leave it on for this image via that page rule, that is useful for us to reference.

2 Likes

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.

Just to follow up - our engineers reviewed and confirmed this is a bug with Safari - it has been reported to them and the tracking number is FB10027481.

If this is impacting you - for now you would need to keep WebP disabled in Polish until the Safari team can resolve this particular bug.

1 Like