I'm using CakeDC/users in my application, and when I created a custom error page and when I test, the application redirects to the login page.
In config/permissions.php
[
'role' => '*',
'controller' => 'Error',
'action' => '*',
'bypassAuth' => true,
],