View Full Version : 304 Server Code Question

11-23-2002, 12:32 AM
I am trying to take as much action as I can to reduce bandwidth and want to check something with people that know.

Firstly, if a visitor request a file and they receive the code 304 (not modified) does that mean that they view a cached version? As such is it safe to assume that when they receive this code no bandwidth is used for this request?

Secondly, I also understand that you are able to place requests somewhere (dont know where or how) to server telling them that they can cache the page and for how long. In particular, as the images that I use on my site are never edited, i would love to allow caching of all images for the longest time possible. eg. never expire

Any help would be really cool!!

11-23-2002, 01:38 AM
304 means there's a copy of the page in the browser's cache. The browser will ask the server if it has been modified since the last visit. If not, the server responds with a 304. That means, no bandwidth is used and the browser uses the cached page.
I don't know if it's the same for proxy servers.
Two interesting links: http://www.ircache.net/cgi-bin/cacheability.py
and: http://www.mnot.net/cache_docs/

11-23-2002, 03:11 AM
Thanks Mcookie.

Just got some code from one of the sites and added it to .htaccess and subsequently used the validator link.

Everything seems to be working as I wished and caching instructions/headers seem to be being sent okay!!

Only question I do have is in relation to when the expiry date is set from? For instance the code below is what I added:-

ExpiresActive On
ExpiresByType image/gif A15552000
ExpiresByType image/jpg A15552000
ExpiresByType image/jpeg A15552000
ExpiresByType text/html M300000

Does the expiry time relate to the a: after modification date b: since cached or c: after browser/visitor last accessed page. I am under the impresion that it will infact expire on the "cache" after the specified time and should the file be requested again it will obtain a new copy, with the same header... thus going around in a loop and only refreshing when the previous header expires.

I know this may sound a silly question however although I have read the literature you kindly directed me to, some of it does seem to go in circles for those of us that are a bit......... challenged!!

Oh... thanks again for your previous help......... i have not doubt it will already help me out big time!!