Polish headers disappeared


As referred to the instruction below, “Polish” option is supposed to add two headers to the request,
but if I resize images on Workers, the images wouldn’t have these headers(“cf-bgj” & “cf-polished”).

Could you give me some advice?

Verify Polish is active
Polish adds two headers to image requests that are compressed:
cf-bgj: imgq:85
cf-polished: qual=85, origFmt=jpeg, origSize=95005
cf-cache-status: HIT

My Workers Script below:

addEventListener("fetch", event => {
  if ( event.request.headers.get("via") ) {
    return fetch(event.request)
  } else{
    return event.respondWith(handleRequest(event.request))

async function handleRequest(request) {
  let url = new URL(request.url)

  const imageRequest = new Request(url, {
    headers: request.headers,

  let options = {
    cf: {
      polish : "lossy",
      image: {
        fit: "scale-down",
        width: 1000,
        //height: auto,
        quality: 85

  const response = await fetch(imageRequest, options)

  if (response.ok || response.status == 304) {

    return response;
  } else {
    return new Response(
      `Could not fetch the image — the server returned HTTP error ${response.status}`,
        status: 400,
        headers: {
          'Cache-Control': 'no-cache',


Are you at least on a Business plan? Otherwise you can’t resize to begin with.

Yes I’m using Business plan and image resizing is working fine.

So the image gets resized properly but Polish does not show up?

IIRC Polish depends on the cache, could it be the files are not cached, respectively your origin sends headers which prevent caching? What’s the caching status and can you post a URL?

Thanks for the reply.

Yes the images are resized & compressed finely,
and also I activated Polish option on the dashboard.

Unfortunately the url is not allowed to share though,
here is the response headers:

accept-ranges: bytes
alt-svc: h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400
cache-control: public, max-age=3600
cf-cache-status: HIT
cf-ray: 635e68f5fab1a843-CDG
cf-request-id: 090edfedb90000a8438db48000000001
cf-resized: internal=ok/e t=1.076 v=2021.2.7
content-length: 4302
content-type: image/png
date: Fri, 26 Mar 2021 06:44:22 GMT
etag: "cfkn1VaC127QMbX7lvEojm-A:226a-5abb4de41cf2e"
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
last-modified: Fri, 31 Jul 2020 04:03:14 GMT
server: cloudflare
vary: Accept-Encoding
x-content-type-options: nosniff

Caching seems to work as that request was a hit.

Did you check if Polish is enabled in the dashboard? That’s rather a guess, but it could be that if it isn’t Workers can’t use it either. If it is, my next best guess would be whether resizing deactivates it. Do the Polish headers show up when you don’t resize?

Most of it is speculation though, you might want to open a support ticket for clarification as they should be able to say it with certainty.


Did you check if Polish is enabled in the dashboard?

Yes, now it’s on.

Do the Polish headers show up when you don’t resize?

Yes exactly. When I deactivate the Workers, the headers would include Polish headers.
so I was wondering this Workers script initialize or overwrite headers…

In that case I assume resizing will do Polish’es job already, hence they won’t show up specifically. Open a support ticket for definitive confirmation.

Okay, thanks @sandro

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