And, I think I understand the problem why it's not working for 500. For the 404, since the resource doesn't exist, in that case, it doesn't make any call to any of AEM resource and hence directly jump to error handler and render the error page (could be via include, forward or sendRedirect - all wor...