I reacently moved to Pressflow and have Anon comments enabled on the site. Every time anon user posts a comment, Drupal likes to set a cookie to remember the email, name, homepage etc in a cookie. For majority of users this is not something of a concern. However, when using Varnish, this will result in many MISS cache hits as the cookie is set for 365 days (!!!!)

Can this be made optional? something like:

edit comment.module

/**
 * Validate comment form submissions.
 */
function comment_form_validate($form, &$form_state) {
  global $user;
  $anon_comments_cookie = variable_get('anon_comments_cookie', TRUE);
  if ($user->uid === 0 and $anon_comments_cookie == TRUE) {
    foreach (array('name', 'homepage', 'mail') as $field) {
      // Set cookie for 365 days.
      if (isset($form_state['values'][$field])) {
        setcookie('comment_info_'. $field, $form_state['values'][$field], time() + 31536000, '/');
      }
    }
  }
  comment_validate($form_state['values']);
}

add the following variable to settings.php file:

$conf['anon_comments_cookie'] = FALSE;

Comments

Status: Active » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.