Visit the back-end application through nginx and report an error err_ CONTENT_ LENGTH_ MISMATCH

Geeks, please accept the hero post of 2021 Microsoft x Intel hacking contest>>>

When using hue, it’s a bit slow to load CSS and other files, so we plan to use nginx to load local static files directly to achieve the purpose of acceleration. However, some pages can not be loaded, and the error net:: err will be reported_ CONTENT_ LENGTH_ MISMATCH。

In chrome, please cache or force refresh. The status code of response is 200

The status code of response is 206

In response header, the length of content length is consistent with the actual length of the target file

The above content length mismatch error will appear

If you do not access Tomcat directly through nginx, the system functions normally without this error

Solution:

After checking the error.log log of nginx, it is found that:

2016/08/25 09:59:52 [crit] 24677#0: *1 open() “/var/lib/nginx/tmp/proxy/1/00/0000000001” failed (13: Permission denied) while reading upstream, client: 182.148.107.206, server: 114.55.4.111, request: “GET /notebook/new HTTP/1.1″, upstream: ” http://114.55.4.111 :10081/notebook/new”,

It turns out that there is no permission. By default, nginx uses the directory created by the nginx user. I use the hue user here, so I have to give the permissions of the folder under nginx to hue

sudo chmod -R 775 /var/lib/nginx/
sudo chown -R hue /var/lib/nginx/

Restart nginx and solve the problem

Similar Posts: