Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

3 Answers 3

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

share|improve this answer
    
Your answer inspired me to solve a similar problem –  Tyler Long Nov 20 at 12:55

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.

share|improve this answer

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.

share|improve this answer
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 '11 at 12:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.