Nginx proxy_pass response truncated

jquerynginxnode.js

I use nginx to proxy https request to my application server (currently running on 8443).
This app server serves dynamic pages, some of them including jquery minified.
The pages are in error as it seems jquery is truncated… is there a file size limit or something ?

My nginx conf is the following one:

server {
listen      443;
server_name my_serv.com;
ssl                 on;
ssl_certificate     certificate.pem;
ssl_certificate_key privatekey.pem;

keepalive_timeout 70;

location / {
  proxy_pass https://localhost:8443;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header Host $http_host;
  proxy_buffering off;
  proxy_buffers 8 8k;
}
}

Best Answer

I know this question is super old, but I just ran into the same issue. Make sure the user you are running nginx as has write privileges to the proxy_temp directory. If you are serving a larger response through your proxy server that can't all be held in your proxy_buffers, the rest of the response data gets written to disk in your proxy_temp directory. If it can't because of inadequate privileges (or something else, i.e. disk space), then the response gets truncated.

An easy way to tell is this is the issue is to clear your browser cache, and reload the page with Chrome developer tools open. Find the truncated file in the network tab, and if the size matches your proxy buffer size (64k in your case) then nginx is likely having issues writing to disk.

More info on the nginx proxy_temp_path: http://wiki.nginx.org/HttpProxyModule#proxy_temp_path