We are trying to improve the page load time of a site. In addition to the few other optimizations, I have added a servlet filter to set "Cache-Control" headers to image files(png,gif,jpg). As expected,the image files are now getting cached at the client end and I could verify the expires time of each file by inspecting the temp folder(IE).My question is, browsers still request the static resources and gets a HTTP304 (Not modified) response. I mean,in effect what i have achieved is I have reduced the no of bytes transferred but not the number of network roundtrips (Which in my case is little slow). Is there any other header/way to stop browsers checking the server whether the resource has been modified?
相关问题
- Views base64 encoded blob in HTML with PHP
- Is there a way to play audio on a mobile browser w
- HTML form is not sending $_POST values
- implementing html5 drag and drop photos with knock
-
Why does the box-shadow property not apply to a
@chedine,
Browser cached files should not return a 304 they should return a 200. You should use mod_expires to set the max age and mod_headers to set the Cache-Control headers. Here is an example that returns a valid 200 response for browser cached static files:
What are you cache-control settings, you should be able to set max-age and have it not come back for a period of time.
You might want to try fiddler to look at your http request/response and make sure it is what you think it is.
see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html for details
Yes, on the browser itself. e.g. in IE, under Browsing History settings, option "Check for newer versions of stored pages" - selecting "Never" will then 'honour' the expiry and will avoid the request / not modified trip to the server, until the stated expiry date arrives.