Whenever cache is activated, some requests receive a 404 error


#1

Hi everyone,

I just started using cloudflare a couple of days ago - but noticed something very weird. If I enable development mode (no cache), my website is working as expected using CloudFlare for DNS. However, as soon as I remove this mode and activate the cache, a lot (but not all …) of the resources on my website are giving 404 errors.

As soon as I again activate development mode, it’s working again.

I compared the request headers but they are exactly the same .However, the headers of the answer is different.
With cache activated:
HTTP/2.0 404 Not Found
date: Mon, 20 Aug 2018 22:24:25 GMT
content-type: text/html
cf-cache-status: HIT
vary: Accept-Encoding
expires: Tue, 21 Aug 2018 02:24:25 GMT
cache-control: public, max-age=14400
expect-ct: max-age=604800, report-uri=“https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct
server: cloudflare
cf-ray: 44d8451e49466944-CDG
content-encoding: br
X-Firefox-Spdy: h2

And without cache:
HTTP/2.0 200 OK
date: Mon, 20 Aug 2018 22:29:17 GMT
content-type: text/css
x-content-type-options: nosniff
last-modified: Sun, 19 Aug 2018 17:05:58 GMT
etag: W/“6aea-573ccce7fad63”
cache-control: max-age=1209600
expires: Mon, 03 Sep 2018 22:29:17 GMT
vary: Accept-Encoding
expect-ct: max-age=604800, report-uri=“https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct
server: cloudflare
cf-ray: 44d84c412d8368ae-CDG
content-encoding: br
X-Firefox-Spdy: h2

I couldn’t understand why and couldn’t find any similar topic over the internet. If it helps, the website is developped with Drupal and hosted by 1and1.


#2

If it helps, if I try to open the page with cache activate, I got an error message from nginx:
image
whereas my usuals error 400 are handled by Drupal.


#4

In the working version you have the etag header. Free plan only supports weak ETags but you need to define a page rule.


#5

Hi Xaq,

Thanks for your reply. However, it appears that I am using only week etags: etag: W/“6aea-573ccce7fad63”

And from the documentation:

Weak ETags can be used across all plan levels, and are supported by default.

Thanks


#6

Did you set the page rule too?


#7

Thanks again for answering Xaq. I didn’t set the page rule too - because from what I understand

Weak ETags can be used across all plan levels, and are supported by default. Strong ETags are for Enterprise customers only, require a Page Rule to activate, …

In my case, I am only using week ETags, so there shouldn’t be anything to configure, right? If there is, what exactly needs to be configured, I am a bit puzzled.

Also, what I think would happen if this was the issue is that the missing page will always be reloaded from cache - but here, it shows a 404.
I set-up a rule when I had this issue to disable cache (cache level = bypass) and this allowed me to remove the 404 errors. I tried today to disable that rule and can’t see any 404 anymore (nothing else changed from my perspective)

I will continue monitoring the situation, but it may have been a temporary issue from cloudflare (?)


#8

You don’t need the page rule and it is good to hear everything is working by now.


#9

This topic was automatically closed after 31 days. New replies are no longer allowed.