Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295277

Set X-Drupal-Cache-Max-Age to aid in debugging #cache fun

$
0
0

Problem/Motivation

Debugging caching can be hard.
https://www.previousnext.com.au/blog/ensuring-drupal-8-block-cache-tags-...
...

Although http.response.debug_cacheability_headers: true lets you see your tags and contexts, there's no easy way to see WTF is going on with max-age.

Unfortunately, just knowing what your #cache['max-age'] is doesn't tell you much until this pit of snakes is untangled:

But, at least knowing you're trying to do the right thing could help in the meanwhile. ;)

It also seems very useful to be able to compare Expires vs. Cache-Control vs. X-Drupal-Cache-Max-Age in various circumstances and configurations as we try to navigate the snake pit.

Proposed resolution

If http.response.debug_cacheability_headers: true is in your services.yml file, also set a X-Drupal-Cache-Max-Age response header.

Remaining tasks

  1. Write code
  2. Write tests
  3. Reviews + refinements
  4. RTBC
  5. Commit
  6. Reach back down into the snake pit and try to make progress on making max-age actually work. :/

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

Probably none.


Viewing all articles
Browse latest Browse all 295277

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>