diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index 7f1bfbad18..f954ddd47a 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -1587,9 +1587,15 @@ function drupal_serve_page_from_cache(stdClass $cache) {
   $if_modified_since = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) : FALSE;
   $if_none_match = isset($_SERVER['HTTP_IF_NONE_MATCH']) ? stripslashes($_SERVER['HTTP_IF_NONE_MATCH']) : FALSE;
 
-  if ($if_modified_since && $if_none_match
-      && $if_none_match == $etag // etag must match
-      && $if_modified_since == $cache->created) {  // if-modified-since must match
+  // Check for etag and etag must match.
+  $notModified = $if_none_match && $if_none_match == $etag;
+
+  if ($if_modified_since) {
+    $notModified = $if_modified_since >= $cache->created && (!$if_none_match || $notModified);
+  }
+
+  // Set 304 Not Modified header if content not modified.
+  if($notModified){
     header($_SERVER['SERVER_PROTOCOL'] . ' 304 Not Modified');
     drupal_send_headers($default_headers);
     return;
diff --git a/modules/simpletest/tests/bootstrap.test b/modules/simpletest/tests/bootstrap.test
index effd04bf2f..662fb0353d 100644
--- a/modules/simpletest/tests/bootstrap.test
+++ b/modules/simpletest/tests/bootstrap.test
@@ -150,11 +150,13 @@ class BootstrapPageCacheTestCase extends DrupalWebTestCase {
     $this->assertResponse(304, 'Conditional request with obsolete If-Modified-Since date returned 304 Not Modified.');
 
     $this->drupalGet('', array(), array('If-Modified-Since: ' . $last_modified));
-    $this->assertResponse(200, 'Conditional request without If-None-Match returned 200 OK.');
-    $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.');
+    $this->assertResponse(304, 'Conditional request without If-None-Match but with If-Modified-Since returned 304 Not Modified.');
 
     $this->drupalGet('', array(), array('If-Modified-Since: ' . gmdate(DATE_RFC7231, strtotime($last_modified) + 1), 'If-None-Match: ' . $etag));
-    $this->assertResponse(200, 'Conditional request with new a If-Modified-Since date newer than Last-Modified returned 200 OK.');
+    $this->assertResponse(304, 'Conditional request with new a If-Modified-Since date newer than Last-Modified returned 304 Not Modified.');
+
+    $this->drupalGet('', array(), array('If-Modified-Since: ' . gmdate(DATE_RFC7231, strtotime($last_modified) - 1)));
+    $this->assertResponse(200, 'Conditional request with old a If-Modified-Since date newer than Last-Modified returned 200 OK.');
     $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.');
 
     $user = $this->drupalCreateUser();
