GET请求的请求参数最大长度

在HTTP规范RFC-2616中有这样一段描述:

The HTTP protocol does not place any a priori limit on the length of a URI. Servers MUST be able to handle the URI of any resource they serve, and SHOULD be able to handle URIs of unbounded length if they provide GET- based forms that could generate such URIs. A server SHOULD return 414 (Request-URI Too Long) status if a URI is longer than the server can handle (see section 10.4.15).

Note: Servers ought to be cautious about depending on URI lengths above 255 bytes, because some older client or proxy implementations might not properly support these lengths.

从以上内容中可以看出,HTTP RFC规范中并没有规定GET请求的URI长度,只是说明如果server无法处理太长的URI,可以通过返回414状态码。

规范中虽然未对GET请求的长度做出明确的规定,但是在主流的用户代理浏览器和应用服务器中对GET请求却做出限制或者相关的可配置:

  • Chrome(谷歌)的url长度限制超过8182个字符返回本文开头时列出的错误。
  • IE浏览器(Microsoft Internet Explorer) 对url长度限制是2083(2K+53),超过这个限制,则自动截断(若是form提交则提交按钮不起作用)。

  • Apache能接受url长度限制为8192字符
  • tomcat中通过较多的Connector参数控制url长度限制:
    maxParameterCount:GET和POST请求参数个数,默认是10000
    maxPostSize:POST请求数据最大值
  • nginx可以通过修改配置来改变url请求串的url长度限制:
    client_header_buffer_size 默认值:1k
    large_client_header_buffers默认值:4 8k

大多数浏览器的限制在2k-8k之间,更老的版本浏览器甚至只支持255 bytes。

引用:

https://stackoverflow.com/questions/2659952/maximum-length-of-http-get-request

http://blog.chinaunix.net/uid-26602509-id-4495786.html

https://www.jianshu.com/p/512389822f8b

转载于:https://www.cnblogs.com/lxyit/p/9017326.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值