A video walk-through of installing and using Apache Sling Dynamic Include with AEM Dispatcher running on Apache HTTPD Web Server.

Note:

This video builds on this AEM Dispatcher setup walk-through video.

  1. Download and install the Sling Dynamic Include bundle.

  2. Configure Sling Dynamic Include via the OSGi Configuration Factory at http://<host>:<port>/system/console/configMgr/org.apache.sling.dynamicinclude.Configuration

    Or, to add to an AEM code-base, create the appropriate sling:OsgiConfig node at:

    /apps/<my-app>/config/<runmode>/org.apache.sling.dynamicinclude.Configuration-<configName>.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0"
        xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
        jcr:primaryType="sling:OsgiConfig"
        include-filter.config.enabled="{Boolean}true"
        include-filter.config.path="/content"
        include-filter.config.resource-types="[my-app/components/content/highly-dynamic]"
        include-filter.config.include-type="SSI" 
        include-filter.config.add_comment="{Boolean}false"
        include-filter.config.selector="nocache"
        include-filter.config.ttl=""
        include-filter.config.required_header="Server-Agent=Communique-Dispatcher"
        include-filter.config.ignoreUrlParams="[]"
        include-filter.config.rewrite="{Boolean}true"
        />
    <!--
    * include-filter.config.include-type="SSI | ESI | JSI"
    * include-filter.config.ttl is # of seconds (requires AEM Dispatcher 4.1.11+)
    --->
  3. Update Apache HTTPD Web server's httpd.conf file to enable the Include Module.

    $ sudo vi /private/etc/apache2/httpd.conf
    LoadModule include_module libexec/apache2/mod_include.so
  4. Update the vhost file to respect include directives.

    $ sudo vi /private/etc/apache2/vhosts/aem-publish.local.conf
    
    <VirtualHost *:80>
       <Directory /Library/WebServer/docroot/publish>
          ...
          # Add Includes to enable SSI Includes used by Slind Dynamic Include
          Options FollowSymLinks Includes      
      
          # Set includes to process .html files
          AddOutputFilter INCLUDES .html
          ...
       </Directory>
    </VirtualHost>
    
  5. Update the dispatcher.any configuration file to support (1) nocache selectors and (2) enable TTL support.

    $ sudo vi /private/etc/apache2/conf/dispatcher.any
    /rules {
      ...
      /0009 {
        /glob "*.nocache.html*"
        /type "deny"
      } 
    }
    /cache {
        ...
        /enableTTL "1"
    }
  6. Always restart Apache HTTPD Web Server after making changes to HTTPD configuration files or the dispatcher.any.

    $ sudo apachectl restart
    

Supporting materials

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy