Experimental project

This is a sandbox project, which contains experimental code for developer use only.

The caching layer nor the database caching implementation respect https through the system. This is important because parts of Drupal (core included) generate absolute URLs. These URLs can be cached with a protocol of http:// and then embedded in a page (through nested caching) where the protocol should be https://.

This contains a Drupal database caching alternative that attempts to respect caching via https. The default Drupal database cache doesn't think about https (aside from the page cache). That means you could have html cached with absolute urls generated by Drupal using http in caches like the block or filter cache. This data can then bubble up into the https version of the page cache.

This cache is a small layer of logic on top of the current database cache. So, if changes happen there (non-API changes) they will be inherited in this as well.

How to use this cache

In your settings.php file include this cache backend:

$conf['cache_backends'][] = 'sites/all/modules/database-cache-respecting-https/db.cache.inc';

Then set the default caching class to the one included here.

$conf['cache_default_class'] = 'DrupalDatabaseCacheResepectHTTPS';

The cache includes a whitelist of cache bins (tables) that skip checking and
enforcing https. You can alter this list by adding a variable to your settings.php
file like:

$conf['database_cache_respecting_https_whitelist'] = array(
  'cache_page',       // This table already respects https by containing the full url.
  'cache_path',       // Caching of aliases for a page is relative.
  'cache_menu',       // The internal paths we are concerned with are relative as stored here.
  'cache_image',      // This one looks safe too.
  'cache_bootstrap',  // Shouldn't be html in this cache.
  'cache_views',
  'cache_views_data',
  'cache',            // This one has been added to the whitelist.
);

There is a core issue to deal with this at http://drupal.org/node/1377840. This
is considered an interim solution until Drupal core properly handles this.

Project information

  • caution Minimally maintained
    Maintainers monitor issues, but fast responses are not guaranteed.
  • caution Maintenance fixes only
    Considered feature-complete by its maintainers.
  • Created by mfer on , updated