10

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;
}
}
2
  • 2
    Check your error log. It should tell you why any connections were closed early.
    – kolbyjack
    Sep 24, 2011 at 12:19
  • Why don't you let nginx to serve static files like jquery.js?
    – VBart
    Nov 9, 2012 at 14:05

3 Answers 3

10

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

1
  • 1
    Your answer inspired me to solve a similar problem
    – Tyler Liu
    Nov 20, 2014 at 12:55
0

If in the acces logs you're seeing return code 304 (Not Modified) for the truncated file, try to clear the browser's cache. Unfortunately, I couldn't find a way to 'fix' this from the nginx config.

-1

There is, but by default its 1G:

http://wiki.nginx.org/HttpProxyModule#proxy_max_temp_file_size

Like @kolbyjack said, there are probably errors in the error.log to look at.

1
  • 2
    That just defines the max size a temp file can be. nginx won't truncate a response if it can't all be buffered, it will be served synchronously from the upstream.
    – kolbyjack
    Sep 26, 2011 at 12:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .