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;
}
}
sendmoreinfo
  • 1,742
  • 12
  • 33
Luc
  • 518
  • 3
  • 5
  • 20

3 Answers3

9

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

Steve
  • 91
  • 1
  • 3
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.

Marius
  • 151
  • 1
  • 3
-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.

polynomial
  • 3,968
  • 13
  • 24
  • 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