Mobile app version of vmapp.org
Login or Join
Sarah324

: When using resources from cache Firefox show a "304" response but Chrome says "220 (from cache)" While working on some optimizations for my site, I noticed some things in Networking Timings for

@Sarah324

Posted in: #Firefox #GoogleChrome #HttpHeaders

While working on some optimizations for my site, I noticed some things in Networking Timings for Chrome Developer Tools differ from those in Firefox Developer Tools.

Very consistently Chrome loads a number of items on the page giving a "200 (from cache)" response. Those same items on Firefox just show as 304 response items.

I am wondering if anyone can explain this. Below are two screen shots for the same resource. First one from Chrome, the second from Firefox.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Sarah324

1 Comments

Sorted by latest first Latest Oldest Best

 

@Nickens628

This is how an asset (such as an image) is delivered from the server at excellent speed.


When a new connection is made, the server returns the image with status code 200 (OK). It also returns either a cache-control header with a reasonable max-age value of a number in seconds equal to at least 6 months or an expires header with a date at least 6 months in the future or both. Also, a last-modified or e-tag header is returned.
When requesting the resource again without any manual refresh, the asset loads super quick as the cache hasn't expired.
About 6 months later (after cache expired), a request is made to the server for the image along with an if-modified-since or if-none-match header (depending on if last-modified or e-tag was sent to the browser after the first request), and the server compares the data in the headers to see if they match up and if they do, then the server returns a 304 status code with no content, indicating to the browser that it can continue to load its cached content as if its the valid and most updated asset.


I think with google chrome, they like to declare cached responses as 304 status codes. I also read somewhere online that chrome disrespects the cache-control max-age setting in some cases.

See: superuser.com/questions/313131/how-do-i-stop-chrome-sending-cache-control-max-age-0-when-i-hit-enter

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme