Content-Disposition header on content fragment thumbnails | Community
Skip to main content
Level 2
April 5, 2022
Solved

Content-Disposition header on content fragment thumbnails

  • April 5, 2022
  • 1 reply
  • 1961 views

Hi everyone,

We have came across an unexpected behavior when requesting a thumbnail image for a content fragment.

Where instead of displaying the thumbnail image in the browser its being downloaded. Upon further investigation, I believe this is caused by the header present in the response "Content-Disposition: attachment"

Which is asking the browser to download the image instead of displaying as inline.

 

Is there any other way how to get the image path, which can be used as reference?

Is there a settings which could be changed to remove this header without impacting the platform security?

 

The current path example for the thumbnail image:

http://localhost:4502/content/dam/test/content-fragment/cf_sample1/_jcr_content/thumbnail.png

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Anish-Sinha

Hi @zdenekk ,

There are two ways to fix this. You can write a rule at dispatcher rule so that this header will be updated from attachment to inline like this. 

<LocationMatch "\.(?i:txt)|(?i:pdf)|(?i:xml)|(?i:png)$">. -->add all your extensions here
Header set Content-Disposition inline
</LocationMatch>

 

The other approach is to put the configuration in Apache Sling Content Disposition Filter  which is an OOTB service in AEM. Please refer to this: https://aem4beginner.blogspot.com/aem-pdf-is-getting-downloaded-instead

1 reply

Anish-Sinha
Adobe Employee
Anish-SinhaAdobe EmployeeAccepted solution
Adobe Employee
April 5, 2022

Hi @zdenekk ,

There are two ways to fix this. You can write a rule at dispatcher rule so that this header will be updated from attachment to inline like this. 

<LocationMatch "\.(?i:txt)|(?i:pdf)|(?i:xml)|(?i:png)$">. -->add all your extensions here
Header set Content-Disposition inline
</LocationMatch>

 

The other approach is to put the configuration in Apache Sling Content Disposition Filter  which is an OOTB service in AEM. Please refer to this: https://aem4beginner.blogspot.com/aem-pdf-is-getting-downloaded-instead

ZdenekKAuthor
Level 2
April 5, 2022

Thank you @anish-sinha for the quick reply