Apache sling error handling : No resource Found
After i introduced sling error handling i.e /apps/sling/servlet/errorhandler/404.jsp in my project i 'm facing the below issue on author
When i open a page on author instance being a anonymous user , It takes me to no resource found page instead of log in page. below is the screenshot

If i log in via crxde and open the page it opens fine, Please let me know if someone has faced similar issue and know the solution.
I m using AEM 6.3 version and i have 404.jsp as well as 404 page in place. It works fine on local but it behaves as mentioned above on higher environments.
