httpbrowserhttp-status-code-304

getting a http-304-status, but still data is transfered


I am wondering about this observation:

I load a website for the second time and the network-module in firefox developer-tools tells me, e.g. for the html document: status=304, type=html, size=60kb.

Some other assets of type=js or css are also flagged as status=304, but have size>0

I am wondering why firefox seems to download an asset that is not modified.

With images it seems to work as expected: whenever an asset is of type=jpeg or png, and status=304, than size=0

Is there any explanation for that?


Solution

  • This is a bug in Firefox developer-tools. The "Transferred" and "Size" column in "Network" panel works incorrect for 304 Not Modified response.

    The "Size" column should display the size of resource (after de-compression if the response is compressed), no matter it is retrieved directly from cache, or retrieved from cache after 304 response, or retrieved from server. In your case, the html/css/js requests work fine, but the jpeg/png requests work incorrectly, the size should not be 0.

    The "Transferred" column should display the bytes transferred through network. Normally it is smaller than "Size" as the response will be compressed. For 304 response, the "transferred" value would be a pretty small number, but would never be 0 (request URL, request headers, response headers etc.).

    Even for Firefox, it does not work consistently. In "FirefoxDeveloperEdition", for 304 response, jpeg/png requests work exactly the same as other html/css/js requests. However, in commonly used "Firefox", the "Size" is 0 and the "Transferred" is "-".