Why is ProgressEvent.lengthComputable false?

后端 未结 5 618
难免孤独
难免孤独 2020-12-03 08:02

I am loading a JSON file using XMLHttpRequest in Google Chrome, Safari and Firefox. In all three browsers I am receiving ProgressEvents which correctly show the

5条回答
  •  情歌与酒
    2020-12-03 08:33

    If lengthComputable is false within the XMLHttpRequestProgressEvent, that means the server never sent a Content-Length header in the response.

    If you're using nginx as a proxy server, this might be the culprit, especially if it's not passing the Content-Length header from the upstream server through the proxy server to the browser.

提交回复
热议问题