Nginx returning 414 even when large_client_header_buffers is set

spacerobot nginx-forum at nginx.us
Tue Apr 10 23:45:21 UTC 2012


Hello,

spacerobot Wrote:
-------------------------------------------------------
> > Most likely you are trying to configure 
> >
> client_header_buffer_size/large_client_header_buff
> 
> > ers in a pure 
> > virtual server{}.  This won't work as request
> > headers parsing 
> > happens before Host header is known (and
> virtual
> > server is 
> > selected), hence parseing happens in a context
> of
> > the default 
> > server for a listen socket.
> > 
> > You have to configure
> >
> client_header_buffer_size/large_client_header_buff
> 
> > ers 
> > in a default server (or at http level).
> > 
> 
> I tried to set it in the http context of the main
> /etc/nginx/nginx.conf file:
> 
> http {
>   large_client_header_buffers  8  512k;
> 
>   ...
>   include /etc/nginx/sites-enabled/*;
> }
> 
> And my server contexts are defined in a conf file
> in sites-enabled. But large_client_header_buffers
> still appears to be ignored.

I further tried the following things, which didn't help either:
- took out most of the configs in my nginx.conf and now I have the
simplest configuration possible, as below.
- upgraded to 1.0.14 stable from 1.0.12 development.

My new simplified nginx.conf:

worker_processes  2;
daemon off;

error_log  /var/log/nginx/error.log;

events {
  worker_connections  2048;
}

http {
  client_header_buffer_size 256k;
  large_client_header_buffers 8 1024k;

  upstream foo.com {
    server 10.0.0.99:16234;
    server 10.0.0.20:16234;
  }

  server {
    listen   443;

    ssl on;
    ssl_certificate /etc/foo.com.crt;
    ssl_certificate_key /etc//foo.com.key;

    server_name  foo;

    access_log  /var/log/nginx/access.log main;

    set $foo "foo.com";

    location / {
      proxy_set_header x-foo-rid $request_id;
      proxy_redirect http://$foo /;
      proxy_pass http://$foo;
    }
  }
}

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,225093,225146#msg-225146



More information about the nginx mailing list