AEM Author -- Static htmls Issue | Community
Skip to main content
Level 3
October 23, 2024
Solved

AEM Author -- Static htmls Issue

  • October 23, 2024
  • 1 reply
  • 1113 views

We are adding some static htmls under /apps/statichtml/ folder . Browser is Properly rending those html's when we access these HTML's with AEM RDE Author environment Url -- <RDE_Author_hostname>/apps/statichtml/index.html. For Same HTMLs, Browser is showing direct html code when we open these with AEM as Cloud Dev Author environment Url -- <DEV_Auhtor_hostname>/apps/statichtml/index.html. When we check the response header's from Dev Author for these statichtml's "Content-Type" header is missing.
As suggestion on how to resolve this issue ?

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 daniel-strmecki

Hi @krishna_chaita2,

in that case, I think you will need to add some custom code and set the appropriate headers. This can be achieved with either a Filter or a Servlet. Maybe something like this:

@Override public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain filterChain) { final SlingHttpServletRequest slingRequest = (SlingHttpServletRequest) request; final SlingHttpServletResponse slingHttpResponse = (SlingHttpServletResponse) response; if (this.isMyStaticHtmlPage(request) { slingHttpResponse.setHeader("content-type", "text/html"); } filterChain.doFilter(request, response); }

 

Hope it helps,

Daniel

1 reply

daniel-strmecki
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
October 23, 2024

Hi @krishna_chaita2,

in case you want to avoid customizations in /apps, you can try to upload your static HTML page in /content/dam and remove the text/html mime type from DamContentDispositionFilter.

 

Hope this helps,

Daniel

 

 

Level 3
October 23, 2024

Hi @daniel-strmecki ,

I tried on keeping html's in dam and updated DamContentDispositionFilter config. In this scenario, html file getting downloaded instead getting rendered.

Our requirement is to have html's in /apps folder only.

 

Thanks

K Chaitanya

daniel-strmecki
Community Advisor and Adobe Champion
daniel-strmeckiCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
October 23, 2024

Hi @krishna_chaita2,

in that case, I think you will need to add some custom code and set the appropriate headers. This can be achieved with either a Filter or a Servlet. Maybe something like this:

@Override public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain filterChain) { final SlingHttpServletRequest slingRequest = (SlingHttpServletRequest) request; final SlingHttpServletResponse slingHttpResponse = (SlingHttpServletResponse) response; if (this.isMyStaticHtmlPage(request) { slingHttpResponse.setHeader("content-type", "text/html"); } filterChain.doFilter(request, response); }

 

Hope it helps,

Daniel