I've set the version to 7.x-1.x-dev but the issue is actually in the 7.x-1.x branch, I can't get -dev to run at all right now. Anyway, the issue here is that variables aren't loaded yet when in authcache_retrieve_cache_page some things don't work as expected. The issue I'm seeing is that Cache-Control's max-age isn't respecting the setting I have. This in turn nullifies the usefulness of varnish for anonymous users.

Inside of include/bootstrap.inc, function drupal_serve_page_from_cache there is a variable_get('page_cache_maximum_age', 0) call being made. Without authcache enabled, this will work properly. But with authcache enabled, Drupal isn't bootstrapped far enough for variables to load. This can be fixed/worked around by adding drupal_bootstrap(DRUPAL_BOOTSTRAP_VARIABLES, FALSE); to authcache.inc in the authcache_retrieve_cache_page function.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

znerol’s picture

Category: bug » feature
Status: Active » Closed (won't fix)

A call to drupal_bootstrap(DRUPAL_BOOTSTRAP_VARIABLES, FALSE) would also initialize the database defeating the purpose of authcache alltogether. You'll be better off by setting page_cache_maximum_age in your settings.php.

simg’s picture

actually Authcache still works surprisingly quickly if you initialise the database. (around 5ms with database compared to 1ms without)

znerol’s picture

Status: Closed (won't fix) » Needs work

Actually it would be possible to handle that like in drupal core. The function _drupal_bootstrap_page_cache checks whether the setting page_cache_without_database is set. If it is not set, it will bootstrap up to the phase DRUPAL_BOOTSTRAP_VARIABLES before delivering the page.

znerol’s picture

Status: Needs work » Needs review
FileSize
729 bytes

Copy-paste patch with the relevant code from _drupal_bootstrap_page_cache. Also includes a call to drupal_block_denied as a bonus.

znerol’s picture

Status: Needs review » Closed (won't fix)

Closing this again. I recommend to hard-code page_cache_maximum_age in settings.php.