Thursday, 18 September 2025

All About AEM Dispatcher: From Basics to Advanced Setup

Quote of the Day

“Every day brings a new opportunity!” 🌱

Why Do We Need Dispatcher in AEM?

  • When a website receives millions of requests, if every request directly hits AEM, it would become slow and overloaded. AEM is powerful for creating, managing, and publishing content, but handling things like caching, redirects, load balancing, and security is not its main job.
  • That’s why we never expose AEM publish servers directly to end users. Instead, we place a web server in between. But a normal web server alone doesn’t know how to work with AEM.
  • To solve this, Adobe provides the Dispatcher – a module that works with the web server.

πŸ‘‰ Dispatcher helps with:

  • Caching → Serves pages instantly without hitting AEM every time

  • πŸ“Š Load Balancing → Distributes traffic across multiple AEM instances

  • πŸ”’ Security → Blocks unwanted requests and protects AEM servers

  • 🎯 Request Handling → Manages redirects and access control

Note:
Dispatcher is the bridge between AEM and the web server, ensuring your website is fast, scalable, and secure.

photo:


What is Dispatcher?

πŸ‘‰ Dispatcher in AEM is a caching and load balancing tool that sits in front of the publish instance. It improves performance by serving cached content, ensures scalability by distributing requests, and adds security by filtering access to AEM.

πŸš€ How to Set Up AEM Dispatcher

πŸ”Ή Step 1: Understand the Architecture

πŸ‘‰ User request → Web Server + DispatcherAEM Publish Instance

Here, Dispatcher is not a standalone server – it’s a module installed on a web server like Apache HTTP Server or Microsoft IIS.

πŸ”Ή Step 2: Install a Web Server

1. Choose your web server (commonly Apache HTTPD).

Open URL and download below highlighted .msi file highlighted red in color to setup Apache Web Server.




2. Go to download folder and double click on httpd-2.2.25-win32-x86-no_ssl.msi file to install the same.

Click on Next button as shown below



3. Select option I accept the terms in the license agreement and click on Next button.


4. Click on Next button as no changes are required.

5. Click on Next button as no changes are required.

6. Select Typical and click on Next button.


7. Select folder to install Apache server if want to install in required folder or else leave it as it is.

8. Click on Install button to start installation.

9. Installation will take 2 to 3 min. It will show below in progress screen:
Click on Finish button once installation is done.
11. Hit http://localhost URL in browser and check if dispatcher setup is successful or not.

12. Open URL and download required file. For current setup we are going to have OpenSSL as none as highlighted below red in color.

13. Unzip downloaded folder and verify below files:

14.copy disp_apache2.2.dll and paste inside apache module folder.





14. Navigate to Apache download folder and looks for httpd.conf file

Inside conf httpd.conf file
15.Add below line to load AEM dispatcher module at line number 129.

After that restart your web server (apache).

16.Copy dispatcher.any file and paste inside conf folder.

17. And add Configuration inside <IfModule> 133 to 147 and add directory 149 to 159, and add 154 SetHandler dispatcher-handler.






πŸ“– Line-by-Line Explanation

  1. <Directory /> ... </Directory>

    • This applies rules to the root directory / (i.e., the entire server).

    • Means: these settings affect all incoming requests.


  1. <IfModule disp_apache2.c>

    • Only applies if the Dispatcher module (disp_apache2.c) is loaded.

    • Dispatcher is Adobe’s caching & load balancing module for AEM.


  1. ModMimeUsePathInfo On

    • Tells Apache to use extra path info after a file.

    • Example: /page.html/extra/path → the /extra/path part is still recognized and passed along.

    • Useful in AEM, where selectors like /page.print.html or /page.html/some/data are common.


  1. SetHandler dispatcher-handler

    • Basically, every request will go through the Dispatcher first (for caching & filtering).


  1. Options FollowSymLinks

    • Allows Apache to follow symbolic links (shortcuts to files/folders).

    • Needed so Apache can resolve linked paths properly.


  1. AllowOverride None

    • Prevents .htaccess files from overriding these settings.

    • Means: only this config file controls behavior, no local overrides.

    • Improves security and performance.

18. Open dispatcher.any file and navigate to line number 65. Just for testing with publish AEM instance, update deny to allow keyword for all request URL’s as shown below:

Update the docroot path inside the cache section of your dispatcher.any farm file to point to your web server’s document root.



21. Update port number from 8080 to your AEM publish post, in my case it is 4503.


Restart Web server (apache).

AEM Publish instance URL

http://localhost:4503/content/we-retail/us/en/men.html


Dispatcher URL

http://localhost/content/we-retail/us/en/men.html

Press enter or click to view image in full size


Both AEM publish and dispatcher URL’s will show the same page. One will be via dispatcher and other by hitting direct AEM publish instance URL using 4503 port.

Thank you!







Press enter or click to view image in full size














Press enter or click to view image in full size



No comments:

Post a Comment

Extending AEM Components Using sling:resourceSuperType — Powered by Sling Resource Merger

Quote's of the day "You never fail until you stop trying" What is Sling Resource Merger ?   Sling Resource Merger is the hidd...