Konfigurera Sling Dynamic Include

En videogenomgång av installation och användning Apache Sling Dynamic Include med AEM körs Apache HTTP Web Server.

NOTE
Kontrollera att den senaste versionen av AEM Dispatcher är installerad lokalt.
  1. Hämta och installera Sling Dynamic Include paket.

  2. Konfigurera Sling Dynamic Include via OSGi Configuration Factory på http://<host>:<port>/system/console/configMgr/org.apache.sling.dynamicinclude.Configuration.

    Eller, om du vill lägga till i en AEM kodbas, skapa sling:OsgiConfig nod vid:

    code language-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. (Valfritt) Upprepa det sista steget för att tillåta komponenter på låst (ursprungligt) innehåll i redigerbara mallar att delges via SDI också. Orsaken till den extra konfigurationen är att låst innehåll i redigerbara mallar hanteras från /conf i stället för /content.

    code language-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="/conf"
        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+)
    -->
    
  4. Uppdatera Apache HTTPD Web server's httpd.conf -fil för att aktivera Include -modul.

    code language-shell
    $ sudo vi .../httpd.conf
    
    code language-shell
    LoadModule include_module libexec/apache2/mod_include.so
    
  5. Uppdatera vhost fil som ska följas innehåller direktiv.

    code language-shell
    $ sudo vi .../vhosts/aem-publish.local.conf
    
    code language-shell
    <VirtualHost *:80>
    ...
       <Directory /Library/WebServer/docroot/publish>
          ...
          # Add Includes to enable SSI Includes used by Sling Dynamic Include
          Options FollowSymLinks Includes
    
          # Required to have dispatcher-handler process includes
          ModMimeUsePathInfo On
    
          # Set includes to process .html files
          AddOutputFilter INCLUDES .html
          ...
       </Directory>
    ...
    </VirtualHost>
    
  6. Uppdatera dispatcher.alla konfigurationsfiler som stöds (1) nocache väljare och (2) aktivera stöd för TTL.

    code language-shell
    $ sudo vi .../conf/dispatcher.any
    
    code language-shell
    /rules {
      ...
      /0009 {
        /glob "*.nocache.html*"
        /type "deny"
      }
    }
    
    note tip
    TIP
    Lämna efterföljande * av i glob *.nocache.html* linje före, kan resultera i problem vid begäran om underresurser.
    code language-shell
    /cache {
        ...
        /enableTTL "1"
    }
    
  7. Starta alltid om Apache HTTP Web Server efter att ha gjort ändringar i konfigurationsfilerna eller dispatcher.any.

    code language-shell
    $ sudo apachectl restart
    
NOTE
Om du använder Sling Dynamic Includes för servering av SSI (edge-side includes), se till att cachelagra relevanta svarsrubriker i dispatchercachen. Följande rubriker är möjliga:
  • "Cache-Control"
  • "Content-Disposition"
  • "Content-Type"
  • "Förfaller"
  • "Senast ändrad"
  • "ETag"
  • "X-content-type-options"
  • "Senast ändrad"

Stödmaterial

recommendation-more-help
c92bdb17-1e49-4e76-bcdd-89e4f85f45e6