How to clear Fastly cache in AEM cloud ? | Community
Skip to main content
Mario248
Level 7
September 23, 2024
Solved

How to clear Fastly cache in AEM cloud ?

  • September 23, 2024
  • 2 replies
  • 4195 views

I want to clear cache in Fastly in aem as a cloud service. Is there any curl command to clear the cache ?  I tried with below command

 

curl -X PURGE https://publish-pxxx-exxx.adobeaemcloud.com/content/my-project/test.html

 

I get "Unauthorized" error message. How do we get "x-aem-purge-key"? Is there any other option available ?

Best answer by daniel-strmecki

Thanks for your response Daniel. I have created a new config pipeline as you mentioned above and also moved a cdn.yaml file to "dispatcher/src/.config/dev/cdn.yaml"

 

 

 

 

I get this error while running the pipeline - 

[ERROR] Error while processing the download and upload to shareName. Cause: InvalidStatusCodeRuntimeException while executing the request
 
I tried without "." like config/dev/cdn.yaml and configured the same in pipeline as "/config/dev" but I get the same error. I also validated the yaml using

"yq eval ****/dev/cdn.yaml"

Am I missing anything ?

Hi @mario248,

the CDN config folder should be in the root folder of your project/codebase, not under Dispatcher in any way. Also, make sure to push the changes to Adobe Git. That should be it.

The dot in the folder name is not a problem, I just like it to be on top.

 

Good luck,

Daniel

2 replies

AMANATH_ULLAH
Community Advisor
Community Advisor
September 23, 2024

@mario248 

You can get the x-aem-purge-key from Adobe team. They can share it for your cloud service environments

However , you can configure Purge API token yourself too, by declaring it in cdn.yaml file as below

https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/content-delivery/cdn-credentials-authentication#purge-API-token

Once you have the Purge Key, use the below Curl to purge cache
curl
-X PURGE "https://publish-p1234-e5467.adobeaemcloud.com/resource-path" \
-H 'X-AEM-Purge-Key: <my_purge_key>' \
-H 'X-AEM-Purge: soft'

https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/content-delivery/cdn-cache-purge

Amanath Ullah
iamnjain
Community Advisor
Community Advisor
September 23, 2024

@mario248 I hope @amanath_ullah answer helps you. On top of this I want to share the official doc link with more Cache Purge options on AEM Cloud 

https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/content-delivery/cdn-cache-purge

 

Hope it help.

Level 3
November 22, 2024

 curl -X PURGE --insecure "https://publish-pxxx-exxx.adobeaemcloud.com/content/my-project/test" -H 'X-AEM-Purge-Key:1111111111111111111111111111111111' -H 'X-AEM-Purge: soft'

 

X-AEM-Purge: soft or hard or all

This is working and I have tested