Caching unsuccessful request

Hey guys,

gotta problem with caching with unsuccessful request - do you know how to set CF caching to not cache these kind of requests?

Thanks for your suggestions.

Is it HTML response? JSON?

404 or 403 error, sorry for not specifying

But are they HTML or JSON? Because HTML and JSON shouldn’t be cached by default unless you have a page rule to cache them.

They are images.

We have a page rule:
Cache Level: Cache Everything, Edge Cache TTL: a day

That is the reason, I get it but i don’t want to CF cached 404/403 requests

Are they matching images URL? Or this page rule is for something else?

If there’s no “Cache Everything” page rule for the images then you can consider setting cache-control: no-store for those URLs returning 403/404 in your server.

Else, unless you have an Enterprise plan - which allows users to set cache TTL by status code, you don’t have another option to go for.

Yes, the rule is matching, because it is like:
domain.com/*

Ok, seems reasonable, I will try to add this setting, thank you a lot!

1 Like

Hi,

we have added the “no-store” setting but problem is still remaining in some way, I will try describe it more further.

We have a image on URL like https://kompasslev.cz//public/gimg/2/6/1/5/6/7/4/2615674-240-390.jpg
but it does not need to exists - if it does not, there is a redirect to our images’ archive like https://archiv.kompasslev.cz/kompasslev.cz//public/gimg/2/6/1/5/6/7/4/2615674-240-390.jpg.

Let’s say that the image does not exists in our server and also in archive - then CF cache the URL like https://archiv.kompasslev.cz/kompasslev.cz//public/gimg/2/6/1/5/6/7/4/2615674-240-390.jpg with 403/404, but after some time the image can apper in URL like https://kompasslev.cz//public/gimg/2/6/1/5/6/7/4/2615674-240-390.jpg and CF can’t reach it, beacause it has cached the archive URL.

Do you have any suggestion how to fix it?

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

Hello,

We have a problem with caching wrong URL:

We have a image on URL like https://kompasslev.cz//public/gimg/2/6/1/5/6/7/4/2615674-240-390.jpg
but it does not need to exists - if it does not, there is a redirect to our images’ archive like https://archiv.kompasslev.cz/kompasslev.cz//public/gimg/2/6/1/5/6/7/4/2615674-240-390.jpg.

Let’s say that the image does not exists in our server and also in archive - then CF cache the URL like https://archiv.kompasslev.cz/kompasslev.cz//public/gimg/2/6/1/5/6/7/4/2615674-240-390.jpg with 403/404, but after some time the image can apper in URL like https://kompasslev.cz//public/gimg/2/6/1/5/6/7/4/2615674-240-390.jpg and CF can’t reach it, beacause it has cached the archive URL.

We have these rules:

.kompasslev.cz/
Cache Level: Cache Everything, Edge Cache TTL: a day

kompasslev.cz/*
Cache Level: Cache Everything, Edge Cache TTL: a day

Do you have any suggestion how to fix it?