Rails Application on Nginx and Thin, 400 Bad Request Request Header or Cookie Too Large

The static page is serving correctly, you can visit: http://www.ec2.lankenow.info/ click on the image and it will take you to the error page.

Nginx error log:

2012/03/16 01:58:41 [alert] 884#0: 768 worker_connections are not enough  

2012/03/16 01:58:41 [error] 887#0: *3900 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 23.21.141.105, server: www.ec2.lankenow.info, request: "GET /leads HTTP/1.0", upstream: "http://23.21.141.105:80/leads", host: "www.ec2.lankenow.info", referrer: "http://www.ec2.lankenow.info/"

      

I think I might have to set client_header_buffer_size, but don't know how or which file to edit. Any direction how to do this would be much appreciated.

EDIT: This can be added to the nginx.conf http section which can be found in the / etc / nginx / or usr / local / nginx / file depending on your installation

Configuration file in / etc / nginx / sites -available /

upstream vdiamond {
    server 0.0.0.0:3000;
    server 0.0.0.0:3001;
    server 0.0.0.0:3002;        
}


server {
    listen   80;
    server_name www.ec2.lankenow.info;

    access_log /home/ubuntu/vdiamond/log/access.log;
    error_log /home/ubuntu/vdiamond/log/error.log;

    root   /home/ubuntu/vdiamond/public/;
    index  index.html;

    location / {

        # Add expires header for static content
        location ~* \.(js|css|jpg|jpeg|gif|png)$ {
            if (-f $request_filename) {
                expires      max;
                break;
            }
        }

        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_read_timeout 300;
        proxy_next_upstream off;

        #proxy_redirect false;

        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://www.ec2.lankenow.info;
            break;
        }
    }
}

      

+3
nginx


source to share


No one has answered this question yet

See similar questions:

26
400 Bad Request - request header or cookie too large

or similar:

26
400 Bad Request - request header or cookie too large
6
what's wrong with this config for nginx as a reverse proxy for node.js?
2
Deploy https docker registry behind nginx on AWS
2
502 Bad Gateway upstream prematurely closed connection while reading upstream response header with flask, uWSGI, nginx
2
Ngnix Jsession changed the redirect issue
1
Vagrant / puppet configuration for complex vhost setup (if assertions etc.)?
1
Constantly reconfiguring Wordpress from nginx upstream
0
Nginx config for Drupal & Boost & ImageCache
0
400 Bad Request Request Header or Cookie Too big nginx
0
How do I write an NGINX config file to use ReactJS? (on Docker)



All Articles
Loading...
X
Show
Funny
Dev
Pics