1

I am trying to achive Varnish HIT for anonymous user but get only MISSes.

It seems that my Drupal 7 site somehow starts new session for every anonymous user which opens even main page of the site. I want to detect which module makes session to start?

2

3 Answers 3

2

Unless you have a strong suspicion on a particular module or a small number of modules that could be creating a session, finding the 'culprit' module could be too tiresome.

I would suggest searching for the 'cookie name' instead of a string like '_SESSION' as a more accurate and a faster way.

Say if the cookie name is 'PLAY_ACTIVE_ACCOUNT' (real example from site play.google.com), you could navigate to the parent directory of your contrib module and do a grep -iRn PLAY_ACTIVE_ACCOUNT * to find the filename and line number of where this session cookie is being set. And then disable the module or take other action.

You can discover the name of your cookie by using your browser. In chrome you could do this by typing chrome://settings/content in a new tab and then clicking on the button 'All cookies and site data'. And then typing in the name of your site domain (like I have used play.google.com for example)

Finding cookie name in chrome browser

1
  • Good idea! Though this wouldn't catch situations where a module simply puts something in the existing Drupal session using $_SESSION['some_key] = 'some_var. For anonymous users this would still create a session that is not trackable using this approach.
    – berliner
    Jan 18, 2014 at 0:49
1

If you think this is a problem in one of the contrib modules installed, you could either deactivate them one after the other to see when the problem goes away, or you could search the code for anything that initializes a session.

The link you posted in the comment can be a viable starting point. My first search would go like this though: grep -r '_SESSION' *

Issued from the root of your contrib modules, e.g. sites/all/modules.

-1

You'll need to look into the database to get the module name from the session cookie.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.