Improve cookbook entry for error pages in 2.3+

This PR cherry-picks the improvements from #4293 and brings them over to 2.3.

It also addresses some of the considerations in #4181.