We recently migrated from AEM 6.5 to AEMasCloud and facing issue for 500 error page redirection. Our Solution is implemented as below and was working fine unless we switched to AEMasCloud.
1. In Dispatcher we have -
ErrorDocument 404 /en-US/404-page-path.html
ErrorDocument 500 /en-US/500-page-path.html
2. In AEM, we have a Component Model and sending error as depicted in below code. Requirement was to keep the URL same and display 500 page in case of any issue.
if (!isAuthor) {
response.addHeader("x-aem-error-pass", "true");// added when migrated to cloud
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
}
We are unable to understand why in Cloud, it is not respecting the dispatcher code written to redirect on basis of 500 error similar to how it was working earlier. Requirement is to show internal server error without changing the current URL.