如何为Nginx请求设置允许的URL长度(错误代码:414,uri太大) [英] How to set the allowed url length for a nginx request (error code: 414, uri too large)

查看:2391
本文介绍了如何为Nginx请求设置允许的URL长度(错误代码:414,uri太大)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在10个怪物面前使用Nginx.

I am using Nginx in front of 10 mongrels.

当我发出大于2900的请求时,我会得到一个回音:

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

错误代码414:uri太大

error code 414: uri too large

有人知道nginx配置文件中的设置,该设置确定允许的uri长度吗?

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

推荐答案

来自: http://nginx.org/r/large_client_header_buffers

语法: large_client_header_buffers number size ;
默认: large_client_header_buffers 4 8k;
上下文: http,服务器

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

设置用于读取大型客户端请求标头的缓冲区的最大 number size .请求行不能超过一个缓冲区的大小,否则会向客户端返回414(请求URI太大)错误.请求标头字段也不能超过一个缓冲区的大小,否则会将400(错误请求)错误返回给客户端.缓冲区仅按需分配.默认情况下,缓冲区大小等于8K字节.如果在请求处理结束后将连接转换为保持活动状态,则会释放这些缓冲区.

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.

因此您需要将该行末尾的size参数更改为更大的值,以适合您的需求.

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

这篇关于如何为Nginx请求设置允许的URL长度(错误代码:414,uri太大)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆