diff --git a/boost.admin.htaccess.inc b/boost.admin.htaccess.inc
index 3bebe36..e84bb5f 100644
--- a/boost.admin.htaccess.inc
+++ b/boost.admin.htaccess.inc
@@ -95,6 +95,16 @@ function boost_admin_htaccess_settings() {
     ),
     '#description'   => t('Uses <a href="!link">FileETag Directive</a> to set <a href="!about">ETags</a> for the files cached by Boost. <a href="!stack">More info on this subject</a>', array('!link' => url('http://httpd.apache.org/docs/trunk/mod/core.html#fileetag'), '!about' => url('http://en.wikipedia.org/wiki/HTTP_ETag'), '!stack' => url('http://stackoverflow.com/questions/tagged?tagnames=etag&sort=votes&pagesize=50'))),
   );
+  $form['htaccess']['boost_apache_vary_cookie'] = array(
+    '#type'          => 'radios',
+    '#title'         => t('Vary Cookie'),
+    '#default_value' => variable_get('boost_apache_vary_cookie', BOOST_APACHE_VARY_COOKIE),
+    '#options'       => array(
+      1 => 'Set Vary Cookie header',
+      0 => 'Do not set Vary Cookie header',
+    ),
+    '#description'   => t('When caching pages for authenticated users, the Vary Cookie header ensures that the browser does not display an old version of a page after login/logout.'),
+  );
   $form['htaccess']['boost_apache_xheader'] = array(
     '#type'          => 'radios',
     '#title'         => t('Boost Tags'),
diff --git a/boost.module b/boost.module
index d4825ad..71511aa 100644
--- a/boost.module
+++ b/boost.module
@@ -57,6 +57,11 @@ define('BOOST_EXPIRE_CRON', TRUE);
 define('BOOST_APACHE_ETAG', 3);
 
 /**
+ * Default setting for whether to include cookies into the vary header.
+ */
+define('BOOST_APACHE_VARY_COOKIE', 0);
+
+/**
  * Default header setttings.
  */
 define('BOOST_APACHE_XHEADER', 1);
@@ -1513,6 +1518,9 @@ function boost_htaccess_cache_dir_generate() {
   $string .= "    Header set Expires \"Sun, 19 Nov 1978 05:00:00 GMT\"\n";
   $string .= "    Header unset Last-Modified\n";
   $string .= "    Header append Vary Accept-Encoding\n";
+  if (variable_get('boost_apache_vary_cookie', BOOST_APACHE_VARY_COOKIE) > 0) {
+    $string .= "    Header append Vary Cookie\n";
+  }
   $string .= "    Header set Cache-Control \"no-store, no-cache, must-revalidate, post-check=0, pre-check=0\"\n";
   if (variable_get('boost_apache_xheader', BOOST_APACHE_XHEADER) > 0) {
     $string .= "    Header set X-Cached-By \"Boost\"\n";
