I am using Nginx in front of 10 mongrels.

When I make a request with size larger then 2900 I get back an:

error code 414: uri too large

Does anyone know the setting in the nginx configuration file which determines the allowed uri length ?

Roald Nefs's user avatar

asked Jul 1, 2009 at 4:59

Prakash Raman's user avatar

Prakash RamanPrakash Raman

13.9k29 gold badges87 silver badges137 bronze badges

From: http://nginx.org/r/large_client_header_buffers

Syntax: large_client_header_buffers number size ;
Default: large_client_header_buffers 4 8k;
Context: http, server

Sets the maximum number and size of buffers used for reading large client request header. A request line cannot exceed the size of one buffer, or the 414 (Request-URI Too Large) error is returned to the client. A request header field cannot exceed the size of one buffer as well, or the 400 (Bad Request) error is returned to the client. Buffers are allocated only on demand. By default, the buffer size is equal to 8K bytes. If after the end of request processing a connection is transitioned into the keep-alive state, these buffers are released.

so you need to change the size parameter at the end of that line to something bigger for your needs.

Community's user avatar

answered Jul 1, 2009 at 5:46

Stobor's user avatar

StoborStobor

45.1k6 gold badges68 silver badges69 bronze badges

9

For anyone having issues with this on https://forge.laravel.com, I managed to get this to work using a compilation of SO answers;

You will need the sudo password.

sudo nano /etc/nginx/conf.d/uploads.conf

Replace contents with the following;

fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;

client_max_body_size 24M;
client_body_buffer_size 128k;

client_header_buffer_size 5120k;
large_client_header_buffers 16 5120k;

answered Jan 18, 2019 at 16:12

Luke Snowden's user avatar

Luke SnowdenLuke Snowden

4,1962 gold badges40 silver badges73 bronze badges

1

I had very similar issue but with a different error

upstream sent too big header while reading response header from upstream

In order to fix it I've changed

server {
....
proxy_buffers   4 32k;
proxy_buffer_size   32k;
...
}

For more information you can visit nginx-doc

answered Feb 23, 2022 at 13:30

ciostek223's user avatar

ciostek223ciostek223

7166 silver badges6 bronze badges