user3332579 user3332579 - 2 months ago 85
Javascript Question

Failed to load resource: net::ERR_CONTENT_LENGTH_MISMATCH

What does this error message mean and how do I resolve it? That is from console of Google Chrome v33.0, on Windows 7.

Failed to load resource: net::ERR_CONTENT_LENGTH_MISMATCH           http://and.img.url/here.png

I'm trying to change the images'
attribute using jQuery. For example like this (simplified):

$('.image-prld').attr('src', someDynamicValue);

There are about 30 images on the page. And the above error is happening for random images every time when I reload the page. But sometimes it is working well for all the images, without any error.

When this error happens, the particular image is displaying like this:

enter image description here

However, when I open the link next to the error message on a new tab, the image is loading, which says me logically that the images is valid and it exists.


This error is definite mismatch between the data that is advertised in the HTTP Headers and the data transferred over the wire.

It could come from the following:

  1. Server: If a server has a bug with certain modules that changes the content but don't update the content-length in the header or just doesn't work properly. It was the case for the Node HTTP Proxy at some point (see here)

  2. Proxy: Any proxy between you and your server could be modifying the request and not update the content-length header.

As far as I know, I haven't see those problem in IIS but mostly with custom written code.

Let me know if that helps.