Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
So the module dynamic page caching is not working when used on authenticated users. When im not authenticated i can see MISS or HIT on X-Drupal-Dynamic-Cache header, but on authenticated users is always UNCACHEABLE, even for static contents. I'm not sure if is this a bug or im doing something wrong, anyway, i would like to know how to hanlde this behaviour.
Comment | File | Size | Author |
---|---|---|---|
#8 | Screen Shot 2017-08-29 at 17.22.58.png | 303.02 KB | Sinan Erdem |
#8 | Screen Shot 2017-08-29 at 17.22.28.png | 47.19 KB | Sinan Erdem |
Comments
Comment #2
borisson_This is a support request, support requests are never critical.
Also, please try to add steps to reproduce this issue. I'm not sure what's meant by "static contents" or how to reproduce that.
PS: The assigned field is used for when you start work on something, not when creating a new issue, I've set this to unassigned.
PS: It seems you (like many others – it's really easy to misinterpret) are confused by the "Issue tags" field. As the guidelines state, they aren't meant for free text tags related to the issue, but only for specific categorization purposes, usually by maintainers.
So, if you aren't sure your current usage is correct, please just leave the field empty.
Comment #3
rober.drupalizeme CreditAttribution: rober.drupalizeme commentedSorry for misunderstandings
To reproduce the error
- Set the cache debug headers (so you can see if the page is being cached)
- Load the page in auth mode and in anonymous mode.
- In auth mode you can see X-Drupal-Dynamic-Cache: "UNCACHEABLE"
- In non auth mode you can see X-Drupal-Dynamic-Cache: "MISS"
UPDATE: I've been able to remove the UNCACHEABLE message by editing services.yml, but my app is still not caching at all, this is the header is always X-Drupal-Dynamic-Cache: "MISS"
Comment #4
Berdirwhat modules do you have installed? what kind of blocks are on those pages? can you reproduce with a default installations?
If you have a debugger, you can give you some hints on where to add breakpoints to figure this out.
Comment #5
Sinan Erdem CreditAttribution: Sinan Erdem commentedI can reproduce this on a fresh install. Dynamic cache never seems to HIT for an authenticated user. I have installed devel/profiler and it shows that the dynamic cache is always a MISS. No extra modules installed. X-Drupal-Dynamic-Cache is UNCACHEABLE all the time (homepage, node, etc)
Comment #6
BerdirThere have been some reports that blocks with node type conditions or possibly related special blocks are causing this. What kind of blocks, modules and configurations do you have that might be special?
Comment #7
Sinan Erdem CreditAttribution: Sinan Erdem commentedHi Berdir, this is a fresh standard installation.
Comment #8
Sinan Erdem CreditAttribution: Sinan Erdem commentedGeneric steps to reproduce this issue:
1. Go to https://simplytest.me/ and launch a box by selecting Devel 8.0 module.
2. Install Drupal as usual.
3. Go to Extensions and enable Devel and Web Profiler.
4. Go to homepage, refresh the page a couple of times.
5. Now you can see from either Web profiler or from Browser's Network tool that Drupal Dynamic cache is UNCACHEABLE. Screenshots attached.
Comment #9
Berdiruser 1 and definitely devel/webprofiler likely add per-user information, that makes perfect sense that it can't be cached then.
It makes more sense to test with normal-ish users that don't have complicated access logic, e.g. for toolbar menu items.
Comment #10
tacituseu CreditAttribution: tacituseu commentedCheck if disabling toolbar module helps (#2899392: user_hook_toolbar() makes all pages uncacheable).
Comment #11
willzyx CreditAttribution: willzyx commented@tacituseu I do not think that is the toolbar module is in se that cause this issue... I think that some implementations of the hook_toolbar like
user_toolbar()
andshortcut_toolbar()
add uncacheable cache contexts or cache contexts with with an high cardinality and this cause the problem..A proof of that? try to disable
shortcut
module and enable the testing moduletoolbar_disable_user_toolbar
on a clean installation and you will see that the issue is gone@Berdir For what I know both webprofiler and devel toolbar implementation are compatible with the dynamic page cache and not cause the page to be uncacheable
Comment #12
tacituseu CreditAttribution: tacituseu commented@willzyx: makes sense,
user_toolbar()
andshortcut_toolbar()
both add 'user' context.Comment #13
Sinan Erdem CreditAttribution: Sinan Erdem commentedI have a confusion about dynamic page cache. I thought it will be useful when there is user specific information on the page. Otherwise static page cache would be enough.
If there is user specific information on the page, is that mean all page would become uncacheable?
Comment #14
Sinan Erdem CreditAttribution: Sinan Erdem commentedI can confirm that disabling Toolbar module resolves the issue. dynamic cache is HIT after disabling toolbar.
Comment #15
penyaskitoLooks like works as designed then. Thanks!
Comment #16
FlutterStack CreditAttribution: FlutterStack as a volunteer and commentedI tried disabling Toolbar module but for me issue hasn't solved.