Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

AEM Graphql Last-Modified response header doesn't update when content is updated and published

Avatar

Level 1

I have a graphql persisted query that pulls the content from AEM via graphql. When I change a content and publish, the updated content is shown in response body but the last-modified response header isn't updated reflect the content modified date

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

2 Replies

Avatar

Community Advisor

Hi @sgochipata1,

This is expected behavior.

  • The Last-Modified HTTP header is set by the GraphQL servlet / dispatcher cache layer, not by the actual content’s JCR modified date.

  • By default, AEM’s persisted GraphQL queries use the query definition / persisted query file as the basis for cache metadata, not the underlying content nodes.

  • When you publish new content:

    • The response body updates correctly (because the query result is re-evaluated).

    • But the Last-Modified header doesn’t reflect your content update, because AEM doesn’t automatically rebind that header to every JCR node’s lastModified property.

Here are what options/workarounds you have:

  1. Enable ETag on the dispatcher/CDN layer so cache invalidation is based on the response body fingerprint, not JCR metadata.

  2. Custom header with content metadata

    • Extend your persisted query endpoint to return a custom header (e.g., X-Content-LastModified) by looking up the max cq:lastModified (or your model’s date field) across the queried nodes.

    • This requires a Sling Filter or custom servlet wrapper.

  3. Dispatcher/CDN cache invalidation

    • Instead of relying on Last-Modified, configure your publish/flush agents or GraphQL endpoint caching so that replication events invalidate cached responses.

    • This is the most common Adobe-recommended approach.

  4. GraphQL response field

    • Add the lastModified property directly into your GraphQL schema model (using cq:lastModified from the fragment/page).

    • Then consumers can handle freshness inside the JSON body, rather than at the HTTP header level.

 


Santosh Sai

AEM BlogsLinkedIn


Avatar

Employee

Hello @sgochipata1 

In AEM, the Last-Modified header on GraphQL persisted query responses does not update when underlying content is changed and published because it reflects only the modification date of the persisted query node itself - not the content fragments returned by the query.

HTTP caching using If-Modified-Since/Last-Modified won’t automatically revalidate on content updates.

You may rely on ETag headers for cache validation, as these can be configured to reflect actual content changes by properly setting up Apache/Dispatcher (e.g., using FileETag Digest). If ETags are missing or inconsistent, adjust your Dispatcher and Apache configuration.

https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/headless/deploym...

For scenarios needing the Last-Modified header to update, you would have to manually republish the persisted query.