My website is using Cloudflare in order to enable SSL (free SSL is not available on my host, Hostgator). Everything seems to be working fine, except when I return a 404 page. That results in
This site can’t be reached
The webpage at https://example.com/example-url might be temporarily down or it may have moved permanently to a new web address.
ERR_INVALID_RESPONSE
If I send a HTTP 200 response code instead of 404, everything works as normal - even for the same URL. I also tried sending HTTP 500, and that works fine too! So it's definitely something about the 404 response code that's causing the problem.
The reason I believe the problem has to do with Cloudflare is that
- It works fine on my local development environment (not using SSL).
- If I run
curl https://example.com/example-url
I get the correct 404 page back, and the HTTP status is 404 as expected.
I have other sites using Cloudflare as well, but they don't seem to have any problems returning a 404 response, which makes me think it's some configuration problem on Cloudflare for this one site.
Any ideas?