Shortened response

I’m having nginx + thin (rails) environment and somehow all my responses
which are larger than 74KB are truncated to that size (ie. my json
response which have up to 100KB are truncated to 74KB, same happens with
larger HTMLs).

When i point browser to thin server response looks fine. Here is my
nginx conf:

user xxxxxx;
worker_processes 1;

events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;

log_format  main  '$remote_addr - $remote_user [$time_local]

“$request” ’
'$status $body_bytes_sent “$http_referer” ’
‘“$http_user_agent” “$http_x_forwarded_for”
“$upstream_addr”’;

access_log  logs/access.log  main;

sendfile        on;

keepalive_timeout  65;

upstream thin {
     server 127.0.0.1:3000;

server 127.0.0.1:3001;
}

server {
    listen       80;
    server_name  localhost;

root /home/xxxx/Rails/yyyyy/public/;

    location / {
    proxy_set_header  X-Real-IP  $remote_addr;
            proxy_set_header  X-Forwarded-For

$proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;

      auth_basic            "Restricted";
      auth_basic_user_file  htpasswd;

  # don't page cache any POST requests
  if ($request_method = POST) {
      proxy_pass http://thin;
      break;
  }

            if (-f $request_filename/index.html) {
                    rewrite (.*) $1/index.html break;
            }
            if (-f $request_filename.html) {
                    rewrite (.*) $1.html break;
            }
            if (!-f $request_filename) {
                    proxy_pass http://thin;
                    break;
            }
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }

}

}

Best

Posted at Nginx Forum:

Hello!

On Tue, Jul 05, 2011 at 08:03:40AM -0400, pupan wrote:

I’m having nginx + thin (rails) environment and somehow all my responses
which are larger than 74KB are truncated to that size (ie. my json
response which have up to 100KB are truncated to 74KB, same happens with
larger HTMLs).

What’s in error log? Best guest is that nginx doesn’t have write
access to proxy_temp_path, it should complain there.

Maxim D.

It worked like a charm, but it’s little bit strange that there is no
mention of perm. denied in error log (last entries are from two days
ago, and also i just turned off rails servers and upstream error is
logged correctly in error.log).

Whatever, tx again.

Posted at Nginx Forum: