'Cloudflare Polish - serve webp/avif images without using /cdn-cgi/image/ URL prefix

Under the documentation for Cloudflare Polish it is mentioned about using the format=auto option. Is there a way to use this option without using the /cdn-cgi/image/ path prefix in my image URLs?

If I do use that path then I see the images served with the content-type: image/webp response header. Without the special URL, I don't see any change to the content-typem (it's just served as jpeg).

The documentation



Solution 1:[1]

It is not necessary to route images via /cdn-cgi/ to make use of Cloudflare Polish. This is applied automatically to images with no change needed to be applied on the URLs.

If you are troubleshooting any issues with this

  1. clear the cloudflare cache for the image URL(s) in question
  2. check the cf-polished response header on the image as this will tell you if optimisation has taken place or if the image was already optimised and thus webp does not give any benefits (in which case you would see the status=webp_bigger in the cf-polished header).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Matthew Dresser