Opening 404 page (page not found) without user session will open 404 page instead of opening login page.

Type atlassian
Reporter gpaunovic
Modified 2020-05-28T06:45:19


h3. Issue Summary Opening a random page on Confluence with a user that is not authenticated will display "Page not found" (404 page) instead of the login page.

h3. Steps to Reproduce

Make sure you are not logged in.

Try to open BaseURL/ABC

h3. Expected Results As you do not have session information you will be pushed to Login page.

h3. Actual Results You see 404, "Page not found".

h3. Workaround Bellow workaround will prevent anonymous users from seeing 404 page, while allowing regular users to see it. - Modify <confluence-install>/confluence/WEB-INF/web.xml 404 block like this: {code:title=From} <error-page> <error-code>404</error-code> <location>/fourohfour.action</location> </error-page> {code} {code:title=To} <error-page> <error-code>404</error-code> <location>/404page.jsp</location> <!--location>/fourohfour.action</location--> </error-page> {code} - Create page <confluence-install>/confluence/404page.jsp with this code: {code} <%@ page import="com.atlassian.seraph.auth.DefaultAuthenticator"%> <% Object loggedInValue = session.getAttribute(DefaultAuthenticator.LOGGED_IN_KEY);

            String context = request.getContextPath();

            if (loggedInValue != null)
                    response.sendRedirect(context + "/fourohfour.action");
                    response.sendRedirect(context + "/login.action");

%> {code} - Restart Confluence.