URL Maximum length limit

Source: Internet
Author: User

In the development of debugging Alipay interface, suddenly found that Alipay interface is very long, far more than the previous impression of 255 characters. Hurriedly search verified a few, understand the following: URL can not be greater than 255bytes of the argument does exist, in the RFC2616 mentioned:

The HTTP protocol does not place any a priori limit on the length of a URI. Servers must is able to handle the URI of an any resource they, serve, and SHOULD is able to handle URIs of unbounded of length I F They provide get-based forms that could generate such. A Server SHOULD return 414 (Request-uri Too Long) status if a URI is longer than the server can handle 5).

Note:servers ought to is cautious about depending on URI lengths above 255 bytes, because some client or proxy older Ementations might not properly support these lengths. As you can see from the above, 255bytes's argument is also for compatibility considerations. In fact, the limitations of modern browsers are as follows:

Microsoft Internet Explorer (Browser)
Microsoft states that this maximum length of a URL in Internet Explorer are 2,083 characters with no more than 2,048 Ters in the path portion of the URL. In my tests, attempts to use URL longer than this produced a clear error message in Internet Explorer.
Firefox (Browser)
After 65,536 characters, the location bar no longer displays the URL in Windows Firefox 1.5.x. However, longer URLs would work. I stopped testing after 100,000 characters.
Safari (Browser)
At least 80,000 characters would work. I stopped testing after 80,000 characters.
Opera (Browser)
At least 190,000 characters would work. I stopped testing after 190,000 characters. Opera 9 for Windows continued to display a fully editable, copyable and pasteable URLs in the location bar even at 190,000 Characters.
Apache (Server)
My early attempts to measure the maximum URL length on Web browsers bumped into a server URL length limit of approximately 4,000 characters, after which Apache produces a "413 Entity the Too Large" error. I used the current up to date Apache builds found in Red Hat Enterprise Linux 4. The official Apache documentation only mentions a 8,192-byte limit on a individual field in a request.
Microsoft Internet Information Server
The default limit is 16,384 characters (yes, Microsoft ' s Web server accepts longer URLs than Microsoft's Web browser). This is configurable.
Perl HTTP::D Aemon (Server)
Up to 8,000 bytes'll work. Those constructing Web application servers with Perl ' s HTTP::D Aemon module'll encounter a 16,384 byte limit on the combi Ned size of all HTTP request headers. This does does not include Post-method form data, file uploads, etc., but it does include the URL. In practice this resulted in a 413 the error when a URL is significantly longer than 8,000. This limitation can be easily removed. Look for all occurrences the 16x1024 in daemon.pm and replace them with a larger value. Of course, this does increase your exposure to denial of service attacks. It is also noteworthy that there are articles that refer to the href attribute of <a>, url cannot exceed 1024bytes, this is not detailed verification

In summary, the URL is not suitable for too long, not the last resort, try not to submit a lot of parameters through get way, you can consider the Post method (about 2M, should be related to the server and settings). Another such long URL is also quite unfriendly when it comes to access and collection (an article mentions that some browsers are also problematic when storing extremely long addresses). Of course, before the database field is set up as a 255bytes processing, you may want to consider expanding it now.

Reference: What is the maximum length of a URL? What is the limit on Querystring/get/url parameters?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.