Dispatcher Returning Incorrect Status(200 instead of 403) for Secure Pages in AEM Cloud Service
We are using AEM cloud service and attempting to implement permission-sensitive caching. We have created an authentication checker servlet that verifies whether a user has access to a page or not. This servlet is functioning correctly and returns a 403 status code for unauthenticated users, as seen in the request.log.
We have also properly configured the dispatcher authentication checker, including setting the servlet URL and filter path to restrict access. Additionally, CDN caching has been disabled.
The problem arises when the dispatcher log returns a 200 status for secure pages, even though the publisher returns a 403 status based on the publisher log. We are able to view the secure page even when logged in as an unauthenticated user.
The provided code is an example of what we have written in the dispatcher to return a 403 status. We are unsure if this code is supported in AEM cloud. We are experiencing similar issues with the 500 error page as well, although the 404 page is functioning correctly. It seems that Apache is unable to redirect to the 403 and 500 error pages, despite the publisher returning the correct status.
We have been reading this document and are wondering if the CDN configuration is necessary for the 403 and 500 error pages.