Skip to main content

Adobe

Overview of Dispatcher & Configuration in Apache Web Server for AEM

Man working on a computer with lines of code superimposed over him.

In this blog, you’ll learn about dispatcher and how to configure it with Apache web server. But before we get to that, let’s discuss AEM author and publisher.

Author
The content that will be published to the publisher is designed, created, and reviewed in the instance. It defaults to using port 4502. Author is the primary data source and can also be referred to as the parent instance.

Publisher
The data that we have replicated from the author to a mapped publisher is essentially contained in publisher, which is the child instance of the author. The role of the publisher is to share out the workload with the author. This instance’s default port is 4503.

Need for Dispatcher

AEM server is a content repository where data is stored, authored and managed. Though AEM itself can be used as a website server to end users, it can’t exactly handle millions of requests. And when those requests hit the AEM servers functionality slows down. There are certain things expected from a well-functioning website like security, caching, redirects, load balancing access requests, and more. That’s where Dispatcher comes into action to serve all this functionality configured with a web server communicating between AEM and the end user.

AEM and Webserver are two different applications and Dispatcher helps them communicate and manage the end user delivery. Dispatcher says what and when to perform.

Dispatcher Configuration In Apache Web Server For Aem

As we can see with the help of the diagram to the left, the end-user sends a request to the web server to access a web page. The dispatcher is configured and accepts the request and fetches the same request to the AEM publisher where data is present in its repository. AEM publisher sends the data requested back to dispatcher and, with the help of web server, it’s delivered to the end user.

Let’s make it happen as we discussed above! Here we’ll try to install the web server and configure dispatcher along with it. But before that we have to setup AEM author and publisher. In the images below, I’ve already completed those steps. Author is running on port 4502 and publisher is running on 4503.Aem Author Publisher

 

Installation of web server

For this we are going to use Windows machine to install Apache web server and we’ll install Apache 2.2 – 32 bit. Now many of you may think, “Why are we installing 32 bit instead of 64 bit?” The answer is because Adobe discontinued the Dispatcher module for Apache 2.4 64-bit Windows machine. Also, we’re using Dispatcher version 4.2.1 which we install in Apache 32-bit server. Use this link to download the Dispatcher module and Apache web server.

Dispatcher Apache Windows 32 Bit

We can see Dispatcher is available for Windows in 32 bit only even though in the image above it’s showing 64 bit. That is for IIS Windows server.

Apache Web Server 32 Bit

Reference Download Link: https://archive.apache.org/dist/httpd/binaries/win32/

For Apache web server, we have selected no “ssl msi” link to keep things simple and easy to configure. Now we’ll install Apache web server by double clicking on our downloaded Apache MSI file and following the instructions.

Downloaded Apache Msi File

Voila! As we can see above Apache web server is installed successfully in our Windows machine by accessing http://localhost in our web browser.

Configure Dispatcher with Apache web server

For configuration, we must specifically change the files “dispatcher.any” and “httpd.conf” in the Dispatcher module folder and on our web server, respectively. From the dispatcher-apache2.2-windows-x86-4.2.1.zip file that was downloaded. Place the “disp apache2.2.dll” file in the “C:\Program Files (x86)\Apache Software Foundation\Apache2.2\modules” directory after moving it from the Dispatcher folder. Then we must replicate the Dispatcher settings below.

Dispatcher Settings For Aem

  • Line 128 denotes the Dispatcher module. It should be written in the file exactly same as what we have copied to module folder.
  • Line 130 to 138 is the If Module section of the configuration (explained below).
  • DispatcherConfig – Dispatcher config set with a path of dispacther.any file which is located under conf folder, make sure the name should be correct as copied in the httpd.conf file.
  • DispatcherLog – This section will log the data which further we have set by level of log to level 3 which denotes debug level which is the most detailed level for logging.
  • DispatcherUseProcessedURL – determines whether to use pre-processed URLs for all further Dispatcher processing 0 denotes use the URL that was initially sent to the web server and 1 denotes instead of using the original URL sent to the web server, the dispatcher uses the URL previously processed by the handlers that come before it (such as mod rewrite).
  • Line 140 to Line 144 – This will handle the incoming requests for the website.

Once all is set, we will restart the Apache web server. Ultimately, Dispatcher and HTTPD installations are complete. For configuration changes to take effect, restart your HTTPD server. If logs/dispatcher.log appears, the dispatcher module is correctly activated on the HTTPD server, and it is working.

Dispatcher Module Activated On Httpd Server

As seen above, typing localhost in our browser will launch our AEM website. As a result, we were able to configure the Dispatcher module inside of our Apache web server.

More to Dispatcher

Using the default parameters, we have seen the Dispatcher’s basic configuration. Dispatcher is more than that though. We can use it to handle several websites that are present on AEM by using the Dispatcher to communicate the web server. According to production standards, we employ a variety of sets of files like farms, virtual hosts, renderings, filters, caching, redirects, and many others.

Let’s briefly explain and define the following terms.

  • Farms: Every set of Dispatcher actions is defined by one or more farms, each of which is linked to a separate website or URL. Any number of farms may be present on the /farms property.
  • Virtual Host: Each of our web domains must have a virtual domain defined by the web server. Configure the document root for each domain to correspond with the repository folder that houses the domain’s web content.
  • Rendering: This is used to export the graphic scene that is now being shown into an image file or description file appropriate for use by one of many outside renderers, which can create a finished image.
  • Filters: Java code fragments known as filters are executed for each request sent to AEM. Every time AEM is called, including calls from images, CSS, JS, and JSON, a filter is run that is not specific to any one application.
  • Redirects: Users and search engines can be sent by a redirect to a different URL from the one they initially requested.

Implementing the above terminology into our Dispatcher will make it easier to administer the various websites we run on a server and track the requests for logs for each of them.

Summary

We have learned about the Dispatcher in this blog and the function it performs between the end user and the AEM server. We have learned how it handles the load of millions of requests on its own and lets the AEM server handle supplying content while the Dispatcher caches that content for end users. Although what we have learned in this blog is only a basic configuration, it may be configured in a more realistic way to serve its purpose in accordance with industry standards. For more information, contact our experts today.

Thoughts on “Overview of Dispatcher & Configuration in Apache Web Server for AEM”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Lalit Kamble

Lalit Kamble is a Technical Consultant at Perficient Nagpur GDC. He started as a System admin and currently working in AEM as Ops support with 6+ years of experience. He enjoys learning and exploring cloud and DevOps tools.

More from this Author

Categories
Follow Us
TwitterLinkedinFacebookYoutubeInstagram