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 ?
Solved! Go to Solution.
Views
Replies
Total Likes
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
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
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'
@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/con...
Hope it help.
I have followed the doc and created a cdn.yaml file inside ../dispatcher/src/conf.d/cdn.yaml.
kind: "CDN"
version: "1"
metadata:
envTypes: ["dev", "stage", "prod"]
data:
authentication: # The main authentication configuration
authenticators: # The list of authenticators
- name: purge-auth # The name of the authenticator
type: purge # The type of the authenticator, must be purge
purgeKey1: ${{CDN_PURGEKEY_081324}} # The first purge key, must be referenced by the Cloud Manager secret-type environment variable name ${{CDN_EDGEKEY_073124}}
purgeKey2: ${{CDN_PURGEKEY_111324}} # The second purge key, must be referenced by the Cloud Manager secret-type environment variable name ${{CDN_EDGEKEY_111324}}. It is used for the rotation of secrets without any interruptions.
rules: # The list of authentication rules
- name: purge-auth-rule # The name of the rule
when: { reqProperty: tier, equals: "publish" } # The condition when the rule should be applied
action: # The action to be taken when the rule is applied
type: authenticate # The type of the action, must be authenticate
authenticator: purge-auth # The name of the authenticator to be used, must match the name from the above authenticators list
And created a cloud manager variable as described
But still I get "Unauthorized Purge" error. Any idea ? Did I place the cdn.yaml file in correct location ?
Hi @Mario248,
don't mix your CDN config and Apache/Dispatcher config. You should place the cnd.yaml file in a dedidated folder in the root of your project, for example .config/dev/cnd.yaml. Then you need to create a config pipeline poiting to that folder, to get your CDN configuration deployed.
Hope this helps,
Daniel
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 -
"yq eval ****/dev/cdn.yaml"
Am I missing anything ?
cdn.yaml file should be placed in config folder which is on the root hierarchy. It should not be part of dispatcher folder.
Please see the sample structure in below link
https://github.com/adobe/aem-guides-wknd/tree/main/config
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
It works Daniel. Thank you for your input and response.
Views
Replies
Total Likes