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

drupalninja99’s picture

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

drupalninja99’s picture

ok problem seems to be only on acquia

Jonah Ellison’s picture

Title: authcache never seems to trigger » Add 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=/';
drupalninja99’s picture

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.

drupalninja99’s picture

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

drupalninja99’s picture

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.

drupalninja99’s picture

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?

Jonah Ellison’s picture

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.

drupalninja99’s picture

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

drupalninja99’s picture

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');
  }
superfedya’s picture

Hi,

Where I need to add it?

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

Thanks

konrad1811’s picture

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

simg’s picture

Status: Active » Closed (fixed)