Index: includes/bootstrap.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v
retrieving revision 1.222
diff -u -F^f -r1.222 bootstrap.inc
--- includes/bootstrap.inc	6 Sep 2008 15:20:09 -0000	1.222
+++ includes/bootstrap.inc	6 Sep 2008 22:55:28 -0000
@@ -629,6 +629,8 @@ function drupal_page_header() {
  *
  */
 function drupal_page_cache_header($cache) {
+  global $user;
+
   // Set default values:
   $last_modified = gmdate('D, d M Y H:i:s', $cache->created) . ' GMT';
   $etag = '"' . md5($last_modified) . '"';
@@ -650,9 +652,27 @@ function drupal_page_cache_header($cache
   header("Last-Modified: $last_modified");
   header("ETag: $etag");
 
-  // The following headers force validation of cache:
-  header("Expires: Sun, 19 Nov 1978 05:00:00 GMT");
-  header("Cache-Control: must-revalidate");
+  if (variable_get('reverse_proxy', 0)) {
+    // If cache_lifetime is not set, then assume 15 minutes
+    $cache_lifetime = variable_get('cache_lifetime', 900);
+
+    // Set a cookie that indicates whether a user is logged in or not, this is used
+    // by the caching proxies
+    if ($user->uid) {
+      // User is logged in, so add a custom header that the reverse proxy can check for.
+      header('X-Drupal-Logged-In: Yes');
+    }
+
+    // The following headers makes for better caching for anonymous users when using
+    // reverse proxies such as Squid or Varnish
+    header('Expires: ' . gmdate("D, d M Y H:i:s", $_SERVER['REQUEST_TIME'] + $cache_lifetime) . ' GMT');
+    header('Cache-Control: public, max-age=' . $cache_lifetime);
+  }
+  else {
+    // Use the old header which does not get cached 
+    header('Expires: Sun, 19 Nov 1978 05:00:00 GMT');
+    header('Cache-Control: must-revalidate');
+  }
 
   if (variable_get('page_compression', TRUE)) {
     // Determine if the browser accepts gzipped data.
Index: sites/default/default.settings.php
===================================================================
RCS file: /cvs/drupal/drupal/sites/default/default.settings.php,v
retrieving revision 1.14
diff -u -F^f -r1.14 default.settings.php
--- sites/default/default.settings.php	21 Aug 2008 19:36:39 -0000	1.14
+++ sites/default/default.settings.php	6 Sep 2008 22:55:28 -0000
@@ -268,6 +268,11 @@
  * logging, statistics and access management systems; if you are unsure
  * about this setting, do not have a reverse proxy, or Drupal operates in
  * a shared hosting environment, this setting should remain commented out.
+ *
+ * Configuration for Squid
+ *   acl drupal_logged_in rep_header "^X-Drupal-Logged-In: Yes$"
+ *   cache deny drupal_logged_in
+ *
  */
 #   'reverse_proxy' => TRUE, // Leave the comma here.
 /**
