Wondering what is the X-Drupal-Cache is?

You, DrupalDrupal cacheVarnish

Hope your familiar with Drupal, Drupal is a popular content management system huh?. Yes! it's not just a content management system it's a content management framework that allows you to create any web application on top of it's powerful core.

Okay, now back to the topic :). What is X-Drupal-Cache?. I saw that first time when I install my Drupal7 + Varnish website, I just wanted to see if my pages are from the Varnish and not a MISS so checked headers. Then I went to the code base of Drupal and search for X-Drupal-Cache. It is really simple you see X-Drupal-Cache if the pages are from drupal page cache. If you enable page cache and when anonymous users access your website they see this header.

Check out Set X-Drupal-Cache header during page_cache_fastpath and Implement better cache headers for reverse proxies for more information about the X-Drupal-Cache header. It seems to be a Drupal 7 only thing.

Going forward you might not like to show that to your users, right? You can use drupal_add_http_header for that.

Links : _drupal_bootstrap_page_cache()

© Heshan Wanigasooriya.RSS

🍪 This site does not track you.