Roy Tang

Programmer, engineer, scientist, critic, gamer, dreamer, and kid-at-heart.

Blog Notes Photos Links Archives About

I’m trying to optimize the loading time of a website. One of the things I’ve done is set a far-futures expires header for static content so that they are cached (as described by Yahoo). However, even though they are cached, the browser still sends a request and gets back a 304 (Not Modified) response for that resource.

I realize the 304 response is very small and probably has minimal performance effect, but is there a way to make it such that the browser will no longer send the request at all and just always use the cache for that resource?

Comments

Wouldn’t that be up to the browser?

You may want to try turning off ETags if you are sending both etags and expires. Some people suggest turning off eTags, especially if you have a load balancer.

Also, note, when you press reload on your page, Firefox WILL recheck all the resources. These will come back with 304’s. If you press shift-reload, it will re-request all the resources without etags. So don’t use the refresh/reload button to test your last-modifed/etag settings.