Add Custom Header in AEM Dispatcher Response | Community
Skip to main content
Level 2
July 18, 2025
Solved

Add Custom Header in AEM Dispatcher Response

  • July 18, 2025
  • 1 reply
  • 349 views

Hi all,

I am trying to add a custom HTTP response header from the dispatcher level in an AEM as a Cloud Service (AEMaaCS) setup.
I want this header to be included in responses served by Dispatcher for tracking/debugging purposes.

What’s the best way to do this in AEMaaCS with Dispatcher configuration?

I have tried editing the dispatcher.yaml but I’m not seeing the header added. Is there a specific file or directive I need to update? And are there any restrictions in AEMaaCS when adding custom headers?

Thanks in advance!

Best answer by SantoshSai

Hi @navyavo,

To add a custom HTTP response header at the Dispatcher level, you'll need to update the Apache HTTPD configuration via the dispatcher.yaml or directly in a custom config under /conf.d.

Here's how you can do it:

Add Header Using Apache Directive

In your custom virtual host config (eg. *.vhost file under /conf.d/available_vhosts/), add:

<Directory />
    Header set X-Content-Source "AEM-Publish"
</Directory>

Or more specifically:

<VirtualHost *:80>
    ServerName www.example.com

    # Existing config...
    
    <Location />
        Header set X-Content-Source "AEM-Publish"
    </Location>

</VirtualHost>

Make sure you have mod_headers enabled (this is typically enabled by default in AEMaaCS Dispatcher SDK).

1 reply

SantoshSai
Community Advisor
SantoshSaiCommunity AdvisorAccepted solution
Community Advisor
July 18, 2025

Hi @navyavo,

To add a custom HTTP response header at the Dispatcher level, you'll need to update the Apache HTTPD configuration via the dispatcher.yaml or directly in a custom config under /conf.d.

Here's how you can do it:

Add Header Using Apache Directive

In your custom virtual host config (eg. *.vhost file under /conf.d/available_vhosts/), add:

<Directory />
    Header set X-Content-Source "AEM-Publish"
</Directory>

Or more specifically:

<VirtualHost *:80>
    ServerName www.example.com

    # Existing config...
    
    <Location />
        Header set X-Content-Source "AEM-Publish"
    </Location>

</VirtualHost>

Make sure you have mod_headers enabled (this is typically enabled by default in AEMaaCS Dispatcher SDK).

Santosh Sai