Disable the AEM Link Checker

This article addresses the AEM concern where link checking is affecting performance during CPU profiling and analyzing thread dumps.

Description description

Environment

Experience Manager 6.4

Issue/Symptoms

If the Link Checker is configured to take no action when a link is broken, how can one disable the external link checker from validating links? In doing CPU profiling and analyzing thread dumps, link checking is affecting performance, and needs to be turned off.

Background:   Whenever a site is loaded in AEM, the Link Checker automatically checks for the embedded links in all the content pages and marks each link as either Valid or Invalid.

This may slow down an instance or a site due to a large number of Link Checker warnings in the log.  A decision can be made to disable some link checking.

Note:  The Link Checker should not be enabled on publish instances.

Resolution resolution

  1. Disable link checking in the pages:

    • Add x-cq-linkchecker="valid" parameter in the a tag to make sure that links are always marked as valid by the Link Checker.

    • Optionally use x-cq-linkchecker="skip" in the a tag Link Checker will not even check for validity.

  2. Completely Disable Link Checker via the AEM Web Console:

    • Access the AEM Web Console Configuration 1.

    • Search for Day CQ Link Checker Transformer.

    • Check the Disable Checking box and click Save.

  3. Disable link checking for a certain domain:

    • Access the AEM Web Console Configuration 1.

    • Search for Day CQ Link Checker Service.

    • Edit the Link Check Override Patterns parameter.

Example 1: system/

Any external link starting with the system will not be checked. Add additional override patterns to this section by clicking the +.

Example 2:

This will mark all links as a valid moving forward.

Recommended: Delete all nodes under /var/linkchecker to stop the Link Checker from rechecking URLs.

{1}http://[ host] :[ port] /system/console/configMgr

Note:  If you use the service.special_link_patterns, then the Link Checker still checks the URL to see if it is valid in terms of the characters and structure.

Programmatically disable external link checking

Adding this code in your page component jsp prevents external link checking from being done by calling LinkCheckerSettings.fromRequest(slingRequest).setIgnoreExternals(true. In most cases, you would only implement it on publish instances, not author. So here is some code to demonstrate:

<%org.apache.sling.runmode.RunMode runmode = sling.getService(org.apache.sling.runmode.RunMode.class);
String[ ]  runmodes = runmode.getCurrentRunModes();
boolean isPublish = false;
String [ ]  expectedRunModes = {"publish"};
if(runmode.isActive(expectedRunModes)) {
isPublish = true;
}

if(isPublish) {
LinkCheckerSettings s = LinkCheckerSettings.fromRequest(slingRequest);
s.setIgnoreExternals(true);
}
%>

If you only want to disable the link checking for a specific component or part of the page, then you can re-enable it again with this code:

<%
s.setIgnoreExternals(false);
%
recommendation-more-help
3d58f420-19b5-47a0-a122-5c9dab55ec7f