Is the (404) errorpage cached?

I did build a nice error (404) page.

In fact, the “page not found” page is even nicer than the homepage :slight_smile:

I turned on cache in config.php and this option did cache the homepage (when visited once), but didn’t cache the 404 page.

Both pages are, of course, powered by Kirby - and the 404 is recognized as an isErrorPage() - but still no cache for that instance.

Is this done by design, or am I doing something wrong?

That’s by design, the error page is not cached, see /kirby/core/page.php, lines 239ff.

1 Like

Cool - I did not read every line of code, luckily you know them all (I guess even upside down :slight_smile: ).

I can imagine the errorpage is not cached, because every error can be different (and should not cache the status / description of it’s predecessor).

Thanks again!

The main reason is that this could be an attack vector. There are infinitely many URLs that lead to the error page, and if each one is accessed, the cache would grow and grow. :slight_smile:

1 Like