Summary
On a self-hosted, multi-instance Directus deployment with the data cache enabled
(CACHE_ENABLED=true, CACHE_STORE=redis), the Data Studio shows stale content
until CACHE_TTL expires, then all changes appear at once. I traced this to the
Studio’s data read requests not sending Cache-Control: no-store, so the server
never skips the cache for the Studio. I’ve confirmed in source that the admin app /
SDK set no Cache-Control request header on both 11.17.4 and the latest
12.4.0. Looking for confirmation of whether this is expected, a known issue, or
something I can configure.
Environment
- Directus 11.17.4 (self-hosted), multiple instances behind a load balancer.
- Also checked source for 12.4.0 (see below).
- Cache config:
CACHE_ENABLED=trueCACHE_STORE=redis(shared Redis/Valkey)CACHE_TTL=5mCACHE_SCHEMA=trueCACHE_STATUS_HEADER=X-Cache-StatusCACHE_AUTO_PURGE=trueCACHE_SKIP_ALLOWED=true
Expected
Per the docs and prior maintainer statements, the Data Studio should send
Cache-Control: no-store on its data reads so editors always see live data, while
public API consumers keep being served from the cache.
Actual
- The Studio’s collection list/layout reads are served from the Redis data cache and
stay stale until the 5m TTL elapses. - In Chrome DevTools (with “Disable cache” ON), the Studio request carries
Cache-Control: no-cache, NOTno-store. Example:
GET /items/my_collection?limit=25&fields=...,status,id&sort[]=id&page=1&filter[status][_neq]=archived - Since the server cache-skip only honours
no-store(api/src/middleware/cache.ts),
no-cachehas no effect and the response is a cache HIT.
What I verified
- Server honours
no-storecorrectly. WithCACHE_SKIP_ALLOWED=true, acurlto
the same endpoint withCache-Control: no-storereturnsX-Cache-Status: MISS
every time; without it returnsHIT. So the server works as intended. - The Studio isn’t sending
no-store. In the admin app source, neither
app/src/api.ts(axios instance) norapp/src/sdk.ts(@directus/sdk+ofetch)
sets anyCache-Controlrequest header. Confirmed in source for bothv11.17.4
andv12.4.0. Theno-cacheseen in the browser appears to be the browser default,
not a header Directus sets. So upgrading to v12 does not change this. - Not my infrastructure. No CDN in front of the Directus domain; the load balancer
rules are plain forwards with no header rewriting; no custom extension sets a request
Cache-Control.
Questions
- Is the Data Studio expected to send
Cache-Control: no-storeon collection item/list
reads in 11.x / 12.x? If so, where is it set, and could the collection layout/list
query path be omitting it? - If the Studio only relies on the browser’s
no-cache(which the server ignores), how
is the Studio meant to show live data when the data cache is enabled on a shared Redis
store across multiple instances? - Is there a supported way to make the Studio bypass the data cache on a multi-instance
deployment, so editors see live data while public reads stay cached? - Related: with
CACHE_AUTO_PURGE=trueon multiple instances, a publish (version
promote → item update) did not invalidate the shared cache in my testing (public read
stayed HIT/old). Is auto-purge expected to clear the shared Redis cache for all
instances on mutation?
Minimal reproduction
- Self-hosted Directus 11.17.4 (or 12.x), 2+ instances,
CACHE_ENABLED=true,
CACHE_STORE=redis,CACHE_TTL=5m,CACHE_STATUS_HEADER=X-Cache-Status. - Open a collection in the Data Studio.
- Change an item via the API/DB (or observe after another user’s edit).
- The Studio list view shows the old value until the 5m TTL elapses.
- DevTools shows the Studio request carries
Cache-Control: no-cache(notno-store).