Search code examples
curlosgiaem

Disable AEM's ink checker using cURL


As per this article - https://helpx.adobe.com/experience-manager/kb/DisableLinkChecker.html to disable link checker in AEM we need to follow these steps -

Disable all link checking by configuration

  1. Go to /system/console/configMgr and login as admin.
  2. Find the "Link Checker Transformer"
  3. Check the "Disable Checking" box and save
  4. Go to /crx/explorer and login as admin
  5. Open "Content Explorer"
  6. Browse to /var/linkchecker
  7. Right click the node and select "Delete Recursively"
  8. Click "Save All"

I want to include disabling link checker as a part of my AEM server's deployment/setup script. Is there a way to do this using cURL?

Thanks


Solution

    • Steps 1 to 4

    To check the Disable Checking box using cURL, this should do the trick:

    curl -u admin:admin http://localhost:4502/system/console/configMgr/com.day.cq.rewriter.linkchecker.impl.LinkCheckerTransformerFactory --data 
    "apply=true&action=ajaxConfigManager&%24location=launchpad%3Aresources%2Finstall%2F0%2Fcq-rewriter-5.9.30.jar&linkcheckertransformer.disableRewriting=false&linkcheckertransformer.disableChecking=true&linkcheckertransformer.mapCacheSize=5000&linkcheckertransformer.strictExtensionCheck=false&linkcheckertransformer.stripHtmltExtension=false&linkcheckertransformer.rewriteElements=a%3Ahref&linkcheckertransformer.rewriteElements=area%3Ahref&linkcheckertransformer.rewriteElements=form%3Aaction&propertylist=linkcheckertransformer.disableRewriting%2Clinkcheckertransformer.disableChecking%2Clinkcheckertransformer.mapCacheSize%2Clinkcheckertransformer.strictExtensionCheck%2Clinkcheckertransformer.stripHtmltExtension%2Clinkcheckertransformer.rewriteElements"
    

    I used firefox network tab (firebug) to capture the above payload. You can do this as well, just check the box and hit save in configMgr and capture the corresponding network req. There is an option to Edit and Resend a request, click that and you'll see the url encoded request body.


    Better way to do this -

    The above cURL updates the field in configMgr (applies to the entire server) and is generally not recommended.

    Instead create a run mode config and modify this field there. This cURL should help you with that. This creates a sling:OsgiConfig node under your apps config node.

    curl  -F "jcr:primaryType=sling:OsgiConfig"  -F linkcheckertransformer.disableChecking=true -F "linkcheckertransformer.disableChecking@TypeHint=Boolean" -u admin:admin  http://localhost:4502/apps/<<YOUR_APP>>/config/com.day.cq.rewriter.linkchecker.impl.LinkCheckerTransformerFactory
    

    • Steps 5 to 8

    curl -u admin:admin -X DELETE http://localhost:4502/var/linkchecker