Expand my Community achievements bar.

Custom Link Response Header for pdfs is not getting set on AEM Cloud Publish Instance

Avatar

Level 1

We have created a custom slingfilter for dam assets
We are setting two custom header through this filter (for all dam assets as pdfs,jpg...)as below:
1. X-Robots-Tag
2. Link

It seems like both headers are getting set through slingfilter (verifying via logs).
But when we hit pdf url from direct publisher only one response header "X-Robots-tag" is coming.
Even on local publish instance both response header are coming.

We have also added these headers in below dispacther files:
1. clientheaders
2. farm files

Still,Only the "X-Robots-Tag" is coming.But "Link" header is not coming.

9 Replies

Avatar

Level 8

@Samikshash 

I guess you might have tried restarted dispatcher already. If not, try restarting dispatcher. This will help making changes take effect.

 

Are using a CDN in front of the Dispatcher. If you are, make sure to whitelist the "Link" header at the CDN level to allow it to pass through to the Dispatcher and AEM instance.

 

Check out this blog post

https://techrevel.blog/2023/09/05/exploring-aem-request-and-response-headers-analysis-of-browser-cdn...

Avatar

Level 1

Thanks @gkalyan for you response.

Yes I have tried restarted dispatcher.

We are using CDN infront of dispatcher. Raised ticket to  to whitelist the "Link" header at the CDN level.

But I am not understanding,if we hit direct publish url(not through dispatcher), do we still need to whitelist the "Link" Header in CDN since "Link" header is not coming in direct publish url.

 

Avatar

Level 8

@Samikshash 

If you are directly hitting the publish url, CDN doesn't come into picture.

 

In this case, are you hitting the publish instance directly ?

 

You should follow what @arunpatidar explained about caching these header to see them.

 

Avatar

Level 1

@gkalyan , Yes I tried hitting the publish instance directly even in that case also only "X-Robots-tag" is coming but "Link" header is not coming.

Avatar

Level 8

@SamikshaSh1 

In AEMaaCS, when you hit publish instance it will go through CDN and dispatcher. Did you try caching these headers like arunpatidar suggested above? That should solve your problem.

Avatar

Community Advisor

Hi @Samikshash 
Please check my response at below for the caching header, if the content is cached then you won't see those header until you cache those headers as well

 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/geo-location-headers-are-n... 



Arun Patidar

Avatar

Level 10

Hi @Samikshash ,

If you have created a custom Sling filter to set custom response headers for DAM assets in AEM, but one of the headers is not being set on the AEM Cloud Publish instance, there could be a few potential reasons for this issue:

1. Dispatcher Configuration: Ensure that the `clientheaders.any` and `farm` files are properly configured on the Dispatcher. Double-check that the headers are correctly specified in the `clientheaders.any` file and that the `farm` file includes the `headers` section with the appropriate headers.

2. CDN Configuration: If you are using a CDN, ensure that the CDN is properly configured to pass through the custom headers. Check the CDN documentation or contact your CDN provider to verify that the headers are allowed and forwarded correctly.

3. Response Code: Verify that the response code for the PDF asset is 200 OK. If the response code is different, it's possible that the headers are not being set due to an error or redirect.

4. Browser Cache: Check if the browser cache is causing the issue. Try clearing the browser cache or using a different browser to see if the headers are being set correctly.

5. AEM Cloud Configuration: If the issue persists, it may be helpful to reach out to Adobe Support to verify if there are any specific configuration requirements for setting custom headers on AEM Cloud Publish instances.

It's also important to note that some headers may be removed or modified by intermediate systems, such as proxies or CDNs, before reaching the end user. This can result in unexpected behavior and may require additional configuration or troubleshooting.

Avatar

Administrator

@Samikshash Did you find the suggestion helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!



Kautuk Sahni

Avatar

Level 1

I tried with all the things mentioned above except CDN whitelist. But didn't find response header working still looking for solution