title: Express and nginx net::ERR_CONTENT_LENGTH_MISMATCH
body: <p>I'm developing an Express-driven site, that is going through an nginx proxy. Sometimes when loading a page in the browser, I get this:</p>
  
  <pre><code>GET http://myapp.local/css/bootstrap.css net::ERR_CONTENT_LENGTH_MISMATCH
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Uku2S.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/Uku2S.jpg" alt="enter image description here"></a></p>
  
  <p>If I refresh the page, it usually goes away. But if refresh over and over and over, it will come up again. </p>
  
  <p>What is the problem here? What can I do to narrow down the issue here? Here is my <code>nginx</code> conf for this server:</p>
  
  <pre><code>server {
    listen 80;
    server_name www.myapp.local;
    rewrite ^(.*) http://myapp.local$1 permanent;
  }
  
  server {
    listen 80;
    server_name myapp.local;
  
    access_log /vagrant/nginx/logs/myapp.local/access.log;
    error_log /vagrant/nginx/logs/myapp.local/error.log;
  
    location / {
      proxy_pass http://localhost:8080;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection 'upgrade';
      proxy_set_header Host $host;
      proxy_cache_bypass $http_upgrade;
    }
  }
  </code></pre>
  
  <p>This is definitely something to do with the nginx proxy. Because if I access the site using just the IP address and Node port: <code>http://10.10.10.10:8080</code> then I never ever get the error. But if I access it using the proxied vhost: <code>http://myapp.local</code> then I will eventually get the error (maybe 1 out of 10 chance I see it).</p>