X-Drupal-Dynamic-Cache
The HTTP X-Drupal-Dynamic-Cache response header is an unofficial HTTP header indicating whether Drupal's Dynamic Page Cache served the response.
Note
The "X-" naming convention for HTTP headers, "X" referring to "experimental", has been deprecated and needs to be transitioned to the formal naming convention for HTTP headers.
Usage
Drupal's Dynamic Page Cache module caches pages for both authenticated and anonymous users by storing responses with placeholders for personalized content. When a cached page is served, Drupal replaces the placeholders with user-specific content at render time. This differs from Drupal's Internal Page Cache (X-Drupal-Cache), which stores fully rendered pages only for anonymous users.
The X-Drupal-Dynamic-Cache header reports the cache
status for each response. A HIT means the page
structure came from cache, with only the personalized
placeholders regenerated. A MISS means no cached
version existed and the full page was rendered from
scratch. UNCACHEABLE means the response contains
content marked as too variable to cache.
The Dynamic Page Cache is enabled by default in Drupal 8 and later. The header works alongside the standard Cache-Control header, which controls browser and CDN Caching. The X-Drupal-Dynamic-Cache header reflects only the internal Drupal caching layer, not any external caching infrastructure.
Values
HIT
A HIT indicates the page was served from Drupal's
Dynamic Page Cache. The cached page structure was
retrieved from the cache backend, and only personalized
placeholders were rendered fresh.
MISS
A MISS indicates no cached version of the page
existed. Drupal rendered the full page from scratch and
stored the result in the Dynamic Page Cache for
subsequent requests.
UNCACHEABLE
An UNCACHEABLE value indicates the page contains
content the Dynamic Page Cache cannot store.
This occurs when a page has poor cacheability metadata,
meaning too much of the content varies per user or per
request to benefit from placeholder-based caching. Some
responses include the reason, such as
UNCACHEABLE (poor cacheability).
Example
A Drupal site serves a product page from the Dynamic Page Cache. The page structure was cached, and only user-specific elements like the shopping cart or login status were rendered fresh.
X-Drupal-Dynamic-Cache: HIT
A first visit to a newly published page generates a cache miss. Drupal renders the full page and stores the result with placeholders in the Dynamic Page Cache for future requests.
X-Drupal-Dynamic-Cache: MISS
A page with highly personalized content, such as a user
dashboard or search results page, is marked as
uncacheable. The poor cacheability annotation
indicates the page has too many variable elements for
the Dynamic Page Cache to be effective.
X-Drupal-Dynamic-Cache: UNCACHEABLE (poor cacheability)
Takeaway
The X-Drupal-Dynamic-Cache header reports whether
Drupal's Dynamic Page Cache served the response, with
values of HIT, MISS, or UNCACHEABLE reflecting
the internal cache status for placeholder-based page
caching.