i have tried several different settings and i keep viewing the page source and turning on debugging but i dont see anything in the source and none of the debugging gets triggered. I have a pressflow site on acquia and i turned on authcache for all the authenticated roles and i am just testing the homepage but nothing seems to happen.

Comments

i have tried the simplest default setting $conf['cache_inc'] = './sites/all/modules/contrib/authcache/authcache.inc'; and still nothing happens

ok problem seems to be only on acquia

Title:authcache never seems to triggerAdd Pressflow compatibility by changing JavaScript detection method
Assigned:Unassigned» Jonah Ellison
Category:support» task

Pressflow does not define the has_js cookie, so Authcache thinks users do not have JavaScript enabled (https://answers.launchpad.net/pressflow/+question/104533).

I'll need to develop a different method to detect JS for Pressflow compatibility, but in the meantime, the workaround would be to add this to your site's JavaScript:

// 'js enabled' cookie
document.cookie = 'has_js=1; path=/';

hmm thats weird bc i test with pressflow on 2 other environments and it works. also acquia does include a settings.inc in the settings.php that assigns some cacherouter values, that might have something to do with it as well. im not getting any errors or anything in the logs, just nothing happens.

oh it is that, i commented out the cookie line in authcache to make it work and it worked

will adding that mess up something pressflow is doing? i imagine they removed that for a reason. i want to use varnish and authcache together.

i added your fix back to drupal.js but i feel like im trading one problem for another. for varnish to work is creating a cookie right there going to mess up varnish?

Yeah, I think you'll need to modify your Varnish config to still serve cached pages to anonymous visitors even if they have the has_js cookie.

maybe i should just load js when a user logs in to create that cookie

I added this to hook_init() and it looks like it works, the idea being to only had a cookie if the user is logged in so as to not add it for anonymous users which messes with varnish. I suppose you could always add a setting somewhere that would trigger this.

  global $user;
  if ($user->uid) {
    drupal_add_js("document.cookie = 'has_js=1; path=/';", 'inline', 'header');
  }

Hi,

Where I need to add it?

global $user;
if ($user->uid) {
drupal_add_js("document.cookie = 'has_js=1; path=/';", 'inline', 'header');
}

Thanks

I tried

// 'js enabled' cookie
document.cookie = 'has_js=1; path=/';

in drupal.js where "killswith" is

but didn't work for me :/

AuthCache was 40ms for anonymous and 300ms for authenticated

Status:Active» Closed (fixed)