CQ5.2.X to CQ5.3 Upgrade: Custom 404 handler causes 404 page to be returned for all pages

Issue

After upgrading from CQ5.2.X to CQ5.3 then all pages in our site return a 404 HTTP status.

Cause

If you have defined a custom 404 error handler in CQ5.2.X /apps/sling/servlet/errorhandler/404.jsp then it will override the custom 404 handler included out of the box in CQ5.3. This will cause all pages to return 404 statuses because your script will override CQ5.3's out of the box script.

Resolution

To resolve this issue:

  1. Rename your custom 404 handler /apps/sling/servlet/errorhandler/404.jsp
  2. Copy /libs/sling/servlet/errorhandler/404.jsp to /apps/sling/servlet/errorhandler/404.jsp
  3. Adapt the out of the box script to do an include of your custom 404 handler. You may do this by replacing the bottom section with your 404 functionality.

    Bottom section of CQ5.3's 404.jsp (referred to above):
... 
 
    // get here if authentication should not take place or if 
    // no Authenticator service is available or if no 
    // AuthenticationHandler is willing to authenticate 
    // So we fall back to plain old 404/NOT FOUND 
     
    // send 404 
    response.setStatus(404); 
     
    %><!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> 
    <html><head> 
    <title>404 Not Found</title> 
    </head><body> 
    <h1>Not Found</h1> 
    <p>The requested URL <%= request.getRequestURI() %> was not found on this server.</p> 
    <hr> 
    <address><%= this.getServletConfig().getServletContext().getServerInfo() %></address> 
    </body></html><% 
%> 

Applies to

CQ5.2.X to CQ5.3 Upgrade

 Adobe

Pyydä apua nopeammin ja helpommin

Oletko uusi käyttäjä?

Adobe MAX 2024

Adobe MAX

The Creativity Conference

14.–16.10. Miami Beach ja verkossa

Adobe MAX 2024

Adobe MAX

The Creativity Conference

14.–16.10. Miami Beach ja verkossa