Nivel 1
Nivel 2
Iniciar sesión en la comunidad
Iniciar sesión para ver todas las insignias
When we make a request to fetch an asset from AEM as a Cloud Service (AEMaaCS), our request doesn’t go straight to the AEM Publish instance. Instead, it’s handled by Adobe’s OOTB CDN, which sits in front of AEM Publisher and serves cacheable content directly from the edge.
If the asset isn’t already cached, the CDN may fetch it from the cloud storage backend where AEM Assets binaries are stored. This storage layer behaves like a blob store and is fully managed by Adobe. Once retrieved, the response is cached at the CDN and served directly from there. Therefore, AEM Publisher is no longer involved in most asset delivery requests.
Because of this new cloud architecture, Sling Filters or Servlets that modify response headers don’t affect CDN-served assets. We can still implement response.setHeader() inside AEM, but unless the CDN explicitly allows that header to be forwarded, it won’t appear in the response sent to the end users.
To handle this properly, Adobe recently added a new CDN configuration property that allows us to override headers for assets.
Override Headers with CDN Config
Adobe provides a YAML-based CDN configuration, which is defined in a file named cdn.yaml, located in a specific project root folder, usually /config. It lets us configure caching rules, request/response manipulations, and other CDN behaviors that control how the OOTB CDN behaves. One of the response transformation properties recently made available by Adobe is overrideBlobHeaders, which allows us to define headers to preserve or override from AEM’s response before serving assets. To deploy a CDN configuration, we need to configure and run a dedicated Config Pipeline in Cloud Manager. Config Pipeline will validate and deploy these settings to the OOTB CDN. The config update is applied almost instantly to the target environment without affecting AEM or Dispatcher.
Add Headers with Sling Filters
Test with AEM Mocks
We can verify our filter behavior using AEM Mocks, ensuring the header logic runs correctly. Our example test calls the doFilter method directly to test only our filter’s logic without depending on Sling’s full request pipeline. This makes unit tests faster, reliable, and focused, avoiding issues with servlet resolution and slow Oak setup. End-to-end behavior, including CDN, still needs to be verified manually on an AEMaaCS environment.
Read the full article on https://meticulous.digital/blog/f/why-your-sling-filters-don%E2%80%99t-affect-asset-headers-in-aemaa... to find out more.
Please use this thread to ask questions relating to this article.
Debe ser un usuario registrado para añadir un comentario aquí. Si ya está registrado, inicie sesión. Si todavía no está registrado, hágalo e inicie sesión.