CQ5.3: 200 response instead of 404 for non-existent page after CRX2.1 upgrade in publish instance

Issue

After upgrading our CQ5.3 publish instance to CRX2.1, it is now returning a 200 response for non-existent pages.

Resolution

Case 1: If you don't have a custom 404 handler installed
If you don't have a custom 404 handler (under /apps/sling/servlet/errorhandler/404.jsp), then please upload and install attached package using CQ5 package manager.

  1. Go to "publish" instance http://<host>:<port>/bin/login.html?resource=/etc/packages.list.html and login as admin
  2. Click on Upload Package
  3. Upload SlingErrorHandler-1.zip click on OK.
  4. Click on Install.
  5. Test by going to a non-existent page.

Case 2: If you have a custom 404 handler installed
If you have custom 404.jsp under /apps/sling/servlet/errorhandler/404.jsp then please update your code as follows:

...
if (!WCMMode.fromRequest(request).equals(WCMMode.DISABLED)) {
    if (isAnonymousUser(request) && isBrowserRequest(request)) {
        ...
    }
}
response.setStatus(404);
...

Applies to

CQ5.3 with CRX2.1

Download

 Adobe

Get help faster and easier

New user?

Adobe MAX 2024

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX 2024

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online