Cloudflare bypassing all Images

Hi,
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.

https://www.slideteam.net/media/catalog/product/cache/330x186/s/t/strategic_roadmap_timeline_showing_milestone_key_dates_and_research_Slide01.jpg
https://stage.slideteam.net/media/catalog/product/cache/330x186/m/c/mckinsey_7s_strategic_management_powerpoint_presentation_slides_Slide01.jpg
4 Likes

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?

Uday

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 https://www.slideteam.net/media/catalog/product/cache/330x186/s/t/strategic_roadmap_timeline_showing_milestone_key_dates_and_research_Slide02.jpg --dump-header - --silent | grep -i set | cut -f1 -d"="
set-cookie: AWSALB
set-cookie: AWSALBCORS
1 Like

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

Thanks again
Uday

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

1 Like

Hi,
Really appreciate your help. The issue is fixed.

Uday

1 Like

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