http 1.1 协议中对url的长度是不受限制的:
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).
翻译:
HTTP协议不对URI的长度作事先的限制,服务器必须能够处理任何他们提供资源的URI,并且应该能够处理无限长度的URIs,这种无效长度的URL可能会在客户端以基于GET方式的请求时产生。如果服务器不能处理太长的URI的时候,服务器应该返回414状态码(此状态码代表Request-URI太长)。
浏览器对url长度限制
浏览器 | 最大长度(字符数) | 备注 |
---|---|---|
Internet Explorer | 2083 | 如果超过这个数字,提交按钮没有任何反应 |
Firefox | 65,536 | |
chrome | 8,182 | |
Safari | 80,000 | |
Opera | 190,000 | |
curl(linux下指令) | 8,167 |
web服务器对于url长度限制
服务器 | 最大长度(字符数) | 备注 |
---|---|---|
Apache (Server) | 8,192 | |
Microsoft Internet Information Server(IIS) | 16,384 | |
nginx | 4,096 (默认) | large_client_header_buffers 最大缓冲区大小设置,默认是4K,可以根据情况而增大 |
tomcat | 65,536 | maxHttpHeaderSize 设置最大请求头长度, |
浏览器对cookie数目的限制
浏览器 | 个数限制(每个域下) | 备注 |
---|---|---|
Internet Explorer | 50(IE6及以下是20) | |
Firefox | 50 | 最后的设置的Cookie始终保留 |
chrome | 180 | |
Safari | 无限制 | |
Opera | 30 |
浏览器对于cookie长度限制
浏览器 | 最大长度(字节) |
---|---|
Internet Explorer | 4,095 |
Firefox | 4,097 |
chrome | 4,097 |
Safari | 4,097 |
Opera | 4,096 |
多字节字符计算为两个字节。在所有浏览器中,任何cookie大小超过限制都被忽略,且永远不会被设置。