IIS and server side includes

MG 1 Reputation point
2021-08-20T09:18:01.55+00:00

I work with Adobe Experience Manger behind IIS. An important part of AEM is the so-called Dispatcher: it's a specialized cache+load balancer. Given a request URL, Dispatcher would usually ask one of the downstream servers (publishes) to render the markup. On subsequent requests, the content is served by the Dispatcher directly from its cache.

AEM rendering is usually quite slow. In our case, rendering of the header takes almost a second. To remedy that I wanted to use Server Side Includes on IIS.

I've added the ServerSideIncludes in Windows Features, and created a Module Mapping for *.html.
Assume we start with an empty cache. I visit in my browser http://my-domain/home.html. Markup when returned directly from a rendering server looks like this:

<body>  
  
<!-- #include virtual="/content/header.html" -->  
  
rest of page</body>  

As the request is further processed through IIS gives me "Error processing SSI file" in the browser instead of the actual header (which means at least that SSI directives are handled by IIS in some way). I can also see only single file home.html being cached. Of course this is not what I want.

If I now visit http://my-domain/content/header.html in my browser, I can see the proper header markup. Because this goes through the Dispatcher, the /content/header.html is now cached as a file on disk alongside home.html. If I now go to http://my-domain/home.html again I can see the proper header in my browser.

From the logs it seems that when IIS handles the request for home.html, the Dispatcher is never asked about "/content/header.html". I thought this is about the order of the two Handler Mappings:

124940-image.png

But the problem persists regardless of their relative order. In Apache httpd the "#include virtual" is handled almost like a fresh request, starting from httpd entry point, in particular the Dispatcher module would be asked for /content/header.html. This seems not to be the case with IIS, it seems only existing files are taken into account for "#include virtual". Is there any way to make the SSI directives ask the Dispatcher module for the content.

Windows development | Internet Information Services
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.