Expand my Community achievements bar.

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

Bypass cache for logged-in users

Avatar

Level 2

 

We’re running AEM as a Cloud Service with the default Dispatcher setup. For anonymous users, caching works fine. But for logged-in users (after SSO), we don’t want certain pages (like /content/myapp/us/en/dashboard.html) to be cached at all - they should always be fresh from Publish.

I tried adding rules like this in dispatcher:
/0018 {
/type "allow"
/glob "/content/myapp/us/en/dashboard.html"
/headers {
"Cache-Control" "no-store"
}
}

but when I test the page is being cached by Dispatcher

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @MateuszNo2,

Try this: 

cache.any

/cache {
  /allowAuthorized "0"           # if request has Authorization, don't cache
  /rules {
    /0010 { /glob "/content/myapp/us/en/dashboard.html*" /type "deny" }  # never cache this path
  }
}

clientheaders.any

Authorization
Cookie

(Forward these so Publish can personalize; Authorization lets /allowAuthorized "0" work.)

Then flush the existing file from the cache (or delete the cached .html under the dispatcher cache root) and retest.


Santosh Sai

AEM BlogsLinkedIn


View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi @MateuszNo2,

Try this: 

cache.any

/cache {
  /allowAuthorized "0"           # if request has Authorization, don't cache
  /rules {
    /0010 { /glob "/content/myapp/us/en/dashboard.html*" /type "deny" }  # never cache this path
  }
}

clientheaders.any

Authorization
Cookie

(Forward these so Publish can personalize; Authorization lets /allowAuthorized "0" work.)

Then flush the existing file from the cache (or delete the cached .html under the dispatcher cache root) and retest.


Santosh Sai

AEM BlogsLinkedIn


Avatar

Level 10

Additionally, to prevent a page from being cached in the CDN, you should set specific response headers:

 

HeaderPurpose
Cache-Control: no-cacheCache must check with server before using a cached response
Cache-Control: no-storeCache must not store this response
Cache-Control: must-revalidateOnce cached response is stale, must revalidate before serving
Pragma: no-cacheHTTP 1.0 backward-compatible no-caching directive
Expires: 0Response is immediately expired; do not serve from cache