Configuring the AEM Dispatcher

Performance and security are quintessential to the overall success of the most basic modern web applications. Dispatcher remains the foundation for these cornerstones in the most recent version of our favorite platform, AEM 6.2. Adobe’s httpd Module Dispatcher functions as a caching and/or load balancing tool that enables digital content managers, authors, and users to experience a faster and more dynamic publishing environment. The Dispatcher lifecycle is one of storing as much static content as possible, distributing user requests across clustered AEM instances, and serving as Web Application Firewall.

Via Dispatcher, AEM page requests are rendered as HTML, and that page and its digital assets are then cached on the server. When an identical request is made in the future, Dispatcher will check if the page incorporates the latest changes. If so, it’ll respond with the pre-rendered page, significantly increasing request throughput and velocity.

Dispatcher Setup

Setting up the Dispatcher is fairly straightforward. Adobe has already done most of the configuration. Step one is to visit the Dispatcher page within Package Share to obtain the latest Dispatcher installation file for your operating system and web server. With the files extracted, you’ll need to start putting them in place.

For Windows:

  • Copy ‘disp_apache2.2.dll’ to your Apache modules folder (Likely C:Program Files(x86)Apache Software FoundationApache2.2modules)
  • Copy ‘dispatcher.any’ to your Apache conf folder (Likely C:Program Files(x86)Apache Software FoundationApache2.2conf)

For Linux (Default Ubuntu Installation):

  • Copy ‘dispatcher-apache2.x-4.1.x.so’ and ‘mod_dispatcher.so’ to your Apache modules folder (Likely /usr/lib/apache2)
  • sudo ln -s dispatcher-apache2.4-4.2.1.so mod_dispatcher.so (Create a symbolic link)
  • Copy ‘dispatcher.any’ to your Apache folder (Likely /etc/apache2)

Next, you’ll begin to configure your httpd.conf file. First, you’ll need to load the dispatcher module:

  • For Windows, add: LoadModule dispatcher_module modules/disp_apache2.x.dll
  • For Linux, add: LoadModule dispatcher_module  /usr/lib/apache2/modules/mod_dispatcher.so

For Linux i.e: ‘LoadModule dispatcher_module libexec/apache2/mod_dispatcher.so’

Configuring Dispatcher Settings

Then, begin the task of configuring the necessary Dispatcher settings.

  • DispatcherConfig: Location and name of the configuration file (Can be given as an absolute or relative path)
  • DispatcherLog: Location and name of the log file *Can be an absolute or relative path
  • DispatcherLogLevel: Log level for the log file
  • DispatcherNoServerHeader: Whether to use the Apache or CQ server header
  • DispatcherDeclineRoot: Defines whether to decline requests to the root “/”
  • DispatcherUseProcessedURL: Defines whether to use the original request URL or to use one already processed by other handlers (ie: mod_rewrite)
    • Note: This is essential for rewriting incoming links (stripping away the ‘content/{site_name}’)
  • DispatcherPassError: Defines whether CQ or Apache will handle HTTP 40x error codes
  • SetHandler (Apache parameter): Forces all matching files to be processed by a handler
    • Must be set to: SetHandler dispatcher-handler
  • ModMimeUsePathInfo
    • When On, the ModMimeUsePathInfo parameter specifies that mod_mime is to determine the content type based on the complete URL; this means that virtual resources will have metainformation applied based on their extension.

For Linux your httpd.conf file should look similar to this:

Code 3 (1)Next, you’ll configure your dispatcher.any. The package downloaded from the Package Share already includes a working dispatcher.any file, however, configurations are usually necessary.

The first essential change will be to the /farms/website/renders node. Once there, set the ‘/hostname’ and ‘/port’ for ‘./rend01’ to properly reflect your publisher.  Adding additional entries under ./renders can be used for load balancing.

Then you’ll find /farms/website/cache and set the ‘./docroot’ node to where Apache’s docroot is also set to (ie: “/var/www”).  Any other configurations necessary will be on a project-specific basis, however, one that is likely to be essential is ignoreUrlParams.

By default, any requests to the Dispatcher with a request parameter attached will force the Dispatcher to ignore what’s in cache and to send the request back down to the publisher. The ignoreUrlParams section rests underneath ‘/farms/website/cache’ and will likely have the following structure:

Code 2 (2)

Once this is all done, you should now have a working Dispatcher for your AEM instance, making your digital environment more efficient and dynamic.

 

Javon Hart

Javon Hart

Javon Hart is a full stack solution expert who specializes in end to end product solutions. Aside from pushing the limits of Front-End Development & Ubiquitous Javascript solutions, Javon is also passionate about his community, country, and Marine Corps Brotherhood. Semper Fidelis