Mobile app version of vmapp.org
Login or Join
Cugini213

: What response headers encourage 304-Not Modified upon reloads? When looking at the network waterfall in Firebug/Chrome/IE9, I keep seeing "200-OK" instead of "304-Not Modified" for many cache-able

@Cugini213

Posted in: #Apache #Cache #CacheControl #HttpdConf #HttpHeaders

When looking at the network waterfall in Firebug/Chrome/IE9, I keep seeing "200-OK" instead of "304-Not Modified" for many cache-able files (images, js, css) on this page, for example.

I believe it is because the browser is not sending a If-Modified-Since during the Request, right? Do I need to change something in the initial Response headers to make 304s happen?

FF13 screenshot

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Cugini213

1 Comments

Sorted by latest first Latest Oldest Best

 

@Gloria169

I believe it is because the browser is not sending a If-Modified-Since during the Request, right?


Correct.


Do I need to change something in the initial Response headers to make 304s happen?


Yes. If you compare original response headers for those resources that have 304 response code on subsequent requests, you will notice:


All of them located in /govtrip/site/grphx/ folder
They have "Etag", "Expires" and "Last-Modified" headers


The first moment tells that most likely there is .htaccess file in that folder that sets those headers (or separate section elsewhere in config file for that folder).

If you look at request headers for those resources with 304 response code, you will see the presence of "If-Modified-Since" and "If-None-Match" headers. Based on those "If-*" headers Apache decides how to reply to the request. I'm sure -- now you can see a pattern here -- very easy to spot which values where used and where.

Resource: /govtrip/site/grphx/system_green.gif

Original response:

Etag: "AAAAS9z9eMo"
Expires: Thu, 14 Jun 2012 18:24:24 GMT
Last-Modified: Wed, 20 Apr 2011 17:29:45 GMT


Subsequent request:

If-Modified-Since: Wed, 20 Apr 2011 17:29:45 GMT
If-None-Match: "AAAAS9z9eMo"

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme