Http请求URL长度限制
生活随笔
收集整理的這篇文章主要介紹了
Http请求URL长度限制
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
http 1.1 協議原文
http 1.1 協議中對url的長度是不受限制的,協議原文:
// https://www.ietf.org/rfc/rfc2616.txt 3.2.1 General SyntaxThe HTTP protocol does not place any a priori limit on the length ofa URI. Servers MUST be able to handle the URI of any resource theyserve, and SHOULD be able to handle URIs of unbounded length if theyprovide GET-based forms that could generate such URIs. A serverSHOULD return 414 (Request-URI Too Long) status if a URI is longerthan the server can handle (see section 10.4.15).Note: Servers ought to be cautious about depending on URI lengthsabove 255 bytes, because some older client or proxyimplementations might not properly support these lengths.翻譯:
HTTP協議不對URI的長度作事先的限制,服務器必須能夠處理任何他們提供資源的URI,并且應該能夠處理無限長度的URIs,這種無效長度的URL可能會在客戶端以基于GET方式的請求時產生。如果服務器不能處理太長的URI的時候,服務器應該返回414狀態碼(此狀態碼代表Request-URI太長)。注:服務器在依賴大于255字節的URI時應謹慎,因為一些舊的客戶或代理實現可能不支持這些長度。 協議中未明確對url進行長度限制,但在真正實現中,url的長度還是受到限制的,一是服務器端的限制,二就是瀏覽器端的限制。長度限制
服務器端
- nginx
nginx服務器默認的限制是4K或者8K
設置參數:large_client_header_buffers
瀏覽器端
| Internet Explorer | 2083 | 如果超過這個數字,提交按鈕沒有任何反應 |
| Firefox | 65,536 | |
| chrome | 8182 | |
| Safari | 80,000 | |
| Opera | 190,000 | |
| curl(linux下指令) | 8167 |
Reference
- https://www.cnblogs.com/lengyuhong/archive/2012/02/04/2330130.html
- http://blog.chinaunix.net/uid-26602509-id-4495786.html
總結
以上是生活随笔為你收集整理的Http请求URL长度限制的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 2020年六十款数据分析的可视化工具推荐
- 下一篇: 微服务/分布式面试题与基础知识总结汇总