Network Error : CONTENT LENGTH MISMATCH

At work, we had this recuring JavaScript error appearing randomly in our logs : Network Error. It's not very explicit isn't it ? Well, it's because that's what Google Chrome let you see from the outside, the full error can only be seen by opening the developper console :

network-error-1

Failed to load resource: net::ERR_CONTENT_LENGTH_MISMATCH.

What was happening is this : the server sometimes returned CSS or JS files with status code 200 and a correct value inside the Content-Length header (which is all normal). But for some reasons, the body of the response was empty ! (causing content length mismatch error)

We searched everywhere : server logs, requests headers, server cache mechanisms, compression mechanisms, application code, operating system, packages versions, DNS records, local network infrastructures, etc. We where never able to find the source of the problem, and on top of that we where never able to reproduce the issue on our computers !!

It's been like that for weeks. Until we understood...

TL;DR

We where not able to reproduce the issue because we all work on linux computers (us, programers), while other employees are on Windows. But not all other employees had this issue ! So we searched for differences between them (applications, chrome extensions, versions, etc.)

Turns out the source of the problem was the antivirus : BitDefender !! They all had the same antivirus settings, but not the same version (explaning why some employees where having the issue while others did not).

We even had a case of a perfectly working computer suddently having this issue, strangely right after an automatic update toward :

bitdefender-update

Version du produit : 6.6.6.84
Version des moteurs : 7.78065 (11802415)

This update also installed a Chrome extension (called TrafficLight ?) checking the safety of google search results, adding a litle green check mark icon. Apparently this thing is doing more than just that because it's messing up https requests too !

google-search-trafficlight

I really don't understand the point of giving over full control of your computer to a third party software like that... To me it's a big hole in security.

Anyway, I'm glad I'm on Linux and don't have to deal with this :)