Custom response headers not displaying on AEM publish instances

Description description

Environment

  • Product: Adobe Experience Manager as a Cloud Service (AEMaaCS) - Sites
  • Instance: Instance

Issue/Symptoms

  • Custom response headers set using a servlet filter don’t appear in HTTP responses from AEM publish instances.
  • Headers display correctly in local development environments but not in the cloud.
  • In the cloud environment, the header appears only when a query parameter is added to the URL.
  • Without a query parameter, the expected custom header is missing from the response.

Resolution resolution

To address the issue, follow these steps:

  • By default, only the response headers listed in the`/headers` section of your dispatcher farm file is passed to the client. The default configuration is:
/headers {
"Cache-Control"
"Content-Disposition"
"Content-Type"
"Expires"
"Last-Modified"
"X-Content-Type-Options"
}
  • On the first request to an uncached resource, the Dispatcher stores the matching headers in a separate file next to the cache file. On subsequent requests, these stored headers are added to the response.
  • To return a custom header, add it to the /headers section in your dispatcher farm file.
  • If you want Dispatcher to fetch a fresh value for a header on every page load, exclude that page from caching.

Notes:

  • File globbing characters are not allowed in the headers section.
  • The clientheaders.any file is used to define allowed incoming request headers—not response headers.

Configure Dispatcher in the AEM Dispatcher Guide

recommendation-more-help
3d58f420-19b5-47a0-a122-5c9dab55ec7f