Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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' src 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.

like image 950
user3332579 Avatar asked May 07 '14 15:05

user3332579


2 Answers

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.

like image 164
Maxime Rouiller Avatar answered Sep 18 '22 15:09

Maxime Rouiller


Docker + NGINX

In my situation, the problem was nginx docker container disk space. I had 10GB of logs and when I reduce this amount it works.

Step by step (for rookies/newbies)

  1. Enter in your container: docker exec -it <container_id> bash

  2. Go to your logs, for example: cd /var/log/nginx.

  3. [optional] Show file size: ls -lh for individual file size or du -h for folder size.

  4. Empty file(s) with > file_name.

  5. It works!.

For advanced developers/sysadmins

Empty your nginx log with > file_name or similar.

Hope it helps

like image 40
mrroot5 Avatar answered Sep 17 '22 15:09

mrroot5