Cloudflare bypassing all Images

For some reason CloudFlare is bypassing all images on one of our sites, but the other site images are being cached. We cannot figure out why.

Here is a sample URL of an image for which cache is being bypassed

but here is a similar url from a different domain for which cache Hit is happening

Any help will be appreciated.

It looks like you have an AWS ELB load balancer with Sticky Sessions enabled. The Set-Cookie header essentially instructs Cloudflare to not cache the production URL. If you do not need the sticky session enabled it would probably be simplest to remove that config from the ELB. Failing that, you can set an Edge Cache TTL to override the bypass.

The URLs for the images you posted are stripped by the forum, I’ve copied them below.

Thank you very much for the response. The hosting guys are saying that Stickiness is disabled. See attached.

I will ask them to confirm again, but in the meantime could there be any other reason?


The reason is that the responses have a Set-Cookie response header. Cloudflare will not by default cache such responses. Setting Edge Cache TTL for the path in question by using the “Cache Everything” setting in a Page Rule will cause Cloudflare to override the default behaviour.

The Set-Cookie response headers I see are:

% curl --dump-header - --silent | grep -i set | cut -f1 -d"="
set-cookie: AWSALB
set-cookie: AWSALBCORS
1 Like

When we do that will login and checkout still work?
We need cookies for all pages - just not for images.

Thanks again

The Page Rule should be configured to match the files you are referring to. You can use a Wildcard Match such as*.jpg to only target files ending in .jpg

1 Like

Really appreciate your help. The issue is fixed.


1 Like

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