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:
GET http://myapp.local/css/bootstrap.css net::ERR_CONTENT_LENGTH_MISMATCH
If I refresh the page, it usually goes away. But if refresh over and over and over, it will come up again.
What is the problem here? What can I do to narrow down the issue here? Here is my nginx
conf for this server:
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;
}
}
This is definitely something to do with the nginx proxy. Because if I access the site using just the IP address and Node port: http://10.10.10.10:8080
then I never ever get the error. But if I access it using the proxied vhost: http://myapp.local
then I will eventually get the error (maybe 1 out of 10 chance I see it).
/var/log/nginx/*
) for all requests involvingbootstrap.css
. Also, see this serverfault answer for a betterrewrite
style using thereturn
keyword (that answer is abouthttps
but it will work as well for removingwww.
from a url_.