Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Far future expire header and HTTP 304

Tags:

http

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?

like image 628
Roy Tang Avatar asked Jan 14 '10 03:01

Roy Tang


1 Answers

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.

like image 90
brianegge Avatar answered Sep 20 '22 22:09

brianegge