April 1, 2020
Estimated Post Reading Time ~

How to flush Cache using Curl Command in Adobe CQ/AEM

Use Case Flush cache for a path in regular interval of time

Solution You can use the following command to flush cache


curl -H "CQ-Action:Flush" -H "CQ-Handle: /content/geometrixx/en/toolbar" -H "CQ-Path:/content/geometrixx/en/toolbar" -H "Content-Length: 0" -H "Content-Type: application/octet-stream" http://dispatcher-server-hostname:port/dispatcher/invalidate.cache

In the Newer version of dispatcher try this

curl -H "CQ-Action: DELETE" -H "CQ-Handle:/content/geometrixx/en/toolbar" -H "CQ-Path:/content/geometrixx/en/toolbar" -H "Content-Length: 0" -H "Content-Type: application/octet-stream" http://dispatcher-server-hostname:port/dispatcher/invalidate.cache

Expected Response: <H1>OK</H1>
If you see error like
[Thu May 30 09:23:53 2013] [D] [91650(140735211479424)] Found farm <Your FARM>
[Thu May 30 09:23:53 2013] [D] [91650(140735211479424)] checking [/dispatcher/invalidate.cache]
[Thu May 30 09:23:53 2013] [W] [91650(140735211479424)] Flushing rejected from <Something>
That mean you are not in allowed list of client to flush cache. In that case please allow your IP (<SOMETHING>) in above case in allowedClient section of dispatcher.any

/allowedClients
{
/0000
{
/glob "*"
/type "deny"
}
/0001
{
/glob "<Something>"
/type "allow"
}
... More allowed
}
}

Important Note: Make sure that from outside (DMZ may be) no one should be able to run this command. This command should be allowed to run only from some trusted boxes


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.