Skip to main content
Level 1
May 17, 2026
Solved

AEMaaCS GraphQL Persisted Queries returning stale Content Fragment data after publish — CDN cache not invalidating

  • May 17, 2026
  • 1 reply
  • 17 views

Hi Community,

Sharing a production issue we debugged recently around GraphQL persisted queries and CDN cache invalidation on AEMaaCS. Curious if others have hit this.

The Setup:
- AEMaaCS with Headless delivery using GraphQL persisted queries
- Content Fragments published from Author to Publish
- Persisted queries cached at CDN layer (Fastly via Adobe-managed CDN)
- Cache-Control headers configured via OSGi: GraphQL servlet max-age set to 7200 seconds

The Problem:
After an author publishes a Content Fragment update, the GraphQL persisted query endpoint continues serving stale data for up to 2 hours. The Publish instance returns fresh data immediately if you bypass CDN (hitting Publish IP directly), but CDN-cached responses are not being invalidated on content publish.

What we tried:
- Verified Replication Agent is working — content reaching Publish ✓
- Verified Publish serving fresh data directly ✓
- Cache-Control max-age reducing from 7200 → 300 — helped but didn't solve root cause ✓
- Dispatcher flush rules — not applicable, GraphQL goes directly to Publish on AEMaaCS ✓

What's the correct architecture for cache invalidation of GraphQL persisted queries on AEMaaCS when content changes?

Best answer by akhil_merupula

Hi ​@deeksha,

 

The issue is that AEMaaCS GraphQL endpoints have no built-in CDN cache invalidation on Content Fragment publish, Dispatcher flush doesn’t apply here since GraphQL goes directly to Publish.

 

Two options:

 

Quick fix: Change your Cache-Control to max-age=300, stale-while-revalidate=3600 content stays at most 5 minutes stale after publish and users never hit a cache miss penalty.

 

Proper fix: Create a custom OSGi EventHandler listening on ReplicationAction.EVENT_TOPIC. When a CF is activated, call the Adobe CDN purge API, POST to your persisted query endpoint with header X-Adobe-Cache-Purge: true. This gets you near-real-time invalidation (~30 seconds after publish).

 

For production I’d recommend both together, stale-while-revalidate as your safety net, plus the replication listener for active purging.

1 reply

akhil_merupulaAccepted solution
Level 3
May 17, 2026

Hi ​@deeksha,

 

The issue is that AEMaaCS GraphQL endpoints have no built-in CDN cache invalidation on Content Fragment publish, Dispatcher flush doesn’t apply here since GraphQL goes directly to Publish.

 

Two options:

 

Quick fix: Change your Cache-Control to max-age=300, stale-while-revalidate=3600 content stays at most 5 minutes stale after publish and users never hit a cache miss penalty.

 

Proper fix: Create a custom OSGi EventHandler listening on ReplicationAction.EVENT_TOPIC. When a CF is activated, call the Adobe CDN purge API, POST to your persisted query endpoint with header X-Adobe-Cache-Purge: true. This gets you near-real-time invalidation (~30 seconds after publish).

 

For production I’d recommend both together, stale-while-revalidate as your safety net, plus the replication listener for active purging.