关于浏览器URL长度

通常会有一个误区就是GET请求参数是有长度限制的。这是错误的。

RFC 2616 (Hypertext Transfer Protocol HTTP/1.1) section 3.2.1 says

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).

在后续的 RFC7230 中做了建议。

Various ad hoc limitations on request-line length are found in practice. It is RECOMMENDED that all HTTP senders and recipients support, at a minimum, request-line lengths of 8000 octets.

所以说所谓的请求长度限制是由浏览器和 web 服务器决定和设置的,各种浏览器和 web 服务器的设定
均不一样,这依赖于各个浏览器厂家的规定或者可以根据 web 服务器的处理能力来设定。

参考文章:https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers

上一篇:CSS BFC 下一篇:JavaScript 中的 __proto__ 和 prototype

发表评论


*