Failed to load resource: net::ERR_CONTENT_LENGTH_MISMATCH

前端 未结 9 626
死守一世寂寞
死守一世寂寞 2020-11-30 06:15

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::ER

相关标签:
9条回答
  • 2020-11-30 06:49

    In my case I was modifying the request to append a header (using Fiddler) to an https request, but I did not configure it to decrypt https traffic. You can export a manually-created certificate from Fiddler, so you can trust/import the certificate by your browsers. See above link for details, some steps include:

    1. Click Tools > Fiddler Options.
    2. Click the HTTPS tab. Ensure the Decrypt HTTPS traffic checkbox is checked.
    3. Click the Export Fiddler Root Certificate to Desktop button.
    0 讨论(0)
  • 2020-11-30 06:52

    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.

    0 讨论(0)
  • 2020-11-30 06:59

    If this is related to docker, try stopping the erroneous container and starting a new container using docker run command from the same image.

    0 讨论(0)
  • 2020-11-30 07:02

    In my case I was miscalculating the Content-Length that I advertised in the header. I was serving Range-Requests for files and I mistakenly published the filesize in Content-Length.

    I fixed the problem by setting Content-Length to the actual range that I was sending back to the browser.

    So in case I am answering to a normal request I set the Content-Length to the filesize. In case I am answering to a range-request I set the Content-Length to the actualy length of the requested range.

    0 讨论(0)
  • 2020-11-30 07:04

    In my case it was a proxy issue (requests proxied from nginx to a varnish cache) that caused the issue. I needed to add the following to my proxy definition

            proxy_set_header Connection keep-alive; 
    
    

    I found the answer here: https://stackoverflow.com/a/55341260/1062129

    0 讨论(0)
  • 2020-11-30 07:06

    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

    0 讨论(0)
提交回复
热议问题