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

查看:71
本文介绍了如何为 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

设置用于读取大型客户端请求标头的缓冲区的最大 numbersize.请求行不能超过一个缓冲区的大小,否则会向客户端返回 414(Request-URI Too Large)错误.请求头域也不能超过一个缓冲区的大小,否则返回400(Bad Request)错误给客户端.缓冲区仅根据需要分配.默认情况下,缓冲区大小等于 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.

因此您需要将该行末尾的大小参数更改为更大的值以满足您的需要.

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天全站免登陆