When I make a request to my site that is proxied through Cloudflare, if I am requesting a resource that doesn't exist (such as /foo), my server returns a 404 (I see my 404 page and testing without proxing through Cloudflare returns a 404) but my browser receives a 200 from Cloudflare. Is there a way around this or to fix it? Would I have to pay for something to do so?
-
Also see this recently asked similar question: When my origin serves a “304 Not Modified”, Cloudflare sends “200 OK” and makes the user download the page again – Stephen Ostermiller♦ Jul 29 '20 at 23:18
-
It seems that is something related to your Cloudflare configuration or an specific rule you have created. I have several domains with Cloudflare and all of them return 404 when a 404 is returned by the server. Check your caching rules maybe... – jalarcon Jul 30 '20 at 17:05
-
I can go through the settings and check, but I'm pretty new to cloudflare so I don't really know what I'm looking for. My caching configuration is pretty much default I think – Sam Jul 31 '20 at 14:42
I figured out that when I specified a custom 404 (and other errors) page in IIS, it returns a 200 OK
instead of the correct error. I solved this by setting the http_response_code()
in my PHP with the correct error number.