Why am I getting a 200 status header when the page is being served from cache? Been running into a weird issue with all of our Drupal 8 websites, hosted on different servers.

The pages are caching correctly, x-drupal-cache header shows a HIT as well. The page however has it's headers set to 200, instead of 304. None of the sites are live yet, so i can't provide a link.

Request Headers:


HTTP/1.1 200 OK 
Date: Fri, 18 Mar 2016 20:09:41 GMT 
Server: Apache/2.4.7 (Ubuntu) 
Cache-Control: max-age=900, public
Expires: Sun, 19 Nov 1978 05:00:00 GMT (Dries' birthdate? O.o)
Last-Modified: Fri, 18 Mar 2016 19:49:21 GMT
Vary: Cookie,Accept-Encoding 
X-Drupal-Cache: HIT 
Keep-Alive:timeout=5, max=100 
Connection: Keep-Alive 
Content-Type: text/html;
charset=UTF-8


Debugging the code Drupal uses to serve pages with 304 headers ( lines 165 to 170 of PageCache.php ) I have found that HTTP_IF_MODIFIED_SINCE and HTTP_IF_NONE_MATCH are not being set.

Thanks!
A Page cache hit just means that Drupal doesn't have to rebuild the HTML but can deliver it from the cache.

That doesn't make any difference at all for your browser. The browser requests the page and gets a HTML response. As far as he's concerned, there's no caching involved.

The built in Page cache has not support for returning 304 responses. Varnish does, but I don't know too much about when that works and when it doesn't. It depends on how you refresh/request the page for example, check if your browser really sends a If-Modified-Since header and if that's in the right form (see some of the answers in the linked stack exchange issue).