SSI for header / footer in AEM - Any issues ? | Community
Skip to main content
New Participant
October 16, 2015
Solved

SSI for header / footer in AEM - Any issues ?

  • October 16, 2015
  • 13 replies
  • 6660 views

Hi,

 
We have developed separate component for managing header / footer. This component / template generate JSON which has header / footer markup. We have some other parties which needs this header / footer so created JSON for easy consumption.
 
For example:
 
{
 
headerDiv : <div> header div here </div>
footerDiv : <div> footer div here </div>
 
}
 
We read this JSON back and add the headerDiv / footerDiv / css / js to the AEM page. So now if we have 10K pages each time there is change in header / footer - then cache clear of all these 10K page needs to be done. This is because headerDiv & footerDiv are part of each page.
 
So thinking to implement SSI for header / footer includes so that if header / footer changes it will start automatically reflecting on all pages.
 
So wanted to check advantages and disavantages of SSI with this group:
 
1) Will there be any performance hit in page load time using SSI ? (now there will be 2 additional SSI calls)
 
2) Is it the case that if header SSI is slow then body will load and page will be without header. Now same page without header is cached in Akamai for sometime. Is there any way to resolve this ?
 
3) Has anyone followed this approach before ? Any other thing which i should consider.
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 joerghoh

Hi,

I understand your scenario. When you want to have your header and footer files included, you should have them also reachable by the dispatcher.

Internally mod_include does not access files directly, but starts sub-requests. The dispatcher is hooked into these requests as well (they are normal requests) and is able to fetch the requested files from publish. Only when these files are available, the mod_include can continue and insert the files into the "main" file. So I don't understand how you encountered this scenario. Can you reproduce it without Akmai? If it's a conceptual problem you should see it even with a regular browser directly hitting the dispatcher.

That's the way how I have seen it implemented at least once and it worked very well.

kind regards,
Jörg

13 replies

joerghoh
Employee
October 16, 2015

Hi,

please enable debugging on the mod_include and post the logs for the first request, when the header is not included.

kind regards,
Jörg

New Participant
October 16, 2015

Thanks Jorg for quick reply. Will share the debug logs.

One observation i saw today:

1. Clear complete dispatcher cache & try accesing the parent HTML. In this 1st hit the SSI section (like header / footer) is missing. But if I do view source of parent HTML then I see that <virtual> directive

<!--#include virtual="/content/header.html" -->

 

2. When when i refresh parent page again then this <virtual> directive is gone and replaced by actual header <div>

 

Does this gives any clue. What i am thinking is on 1st load of page it just keeps <virtual> directtive as normal html source. And on 2nd refresh then it processess it.

New Participant
October 16, 2015

Hi Jorg,

Thanks for all your input. Wanted to give you update that now the SSI include issue is resolved. We had to update the apache config to make it work. Now on first parent page hit itself SSI child gets included.