views:

1948

answers:

7

Is it browser dependent? Also, do different web stacks have different limits on how much data they can get from the request?

A: 

Something about 2k. Not too much.

amartynov
+4  A: 

I'm assuming you mean max length for a uri string. This may help.

Typically once URI's get unreadable because they are too long, it's time to use a POST request instead.

Snazzer
A: 

It depends on what software/hardware the request is going through. I would simply test it on the target environment to find out.

A: 

Different web stacks do support different lengths of http-requests. I know from experience that the early stacks of Safari only supported 4000 characters and thus had difficulty handling ASP.net pages because of the USER-STATE. This is even for POST, so you would have to check the browser and see what the stack limit is. I think that you may reach a limit even on newer browsers. I cannot remember but one of them (IE6, I think) had a limit of 16-bit limit, 32,768 or something.

kdevine
+12  A: 

According to Boutell.com: WWW FAQs: What is the maximum length of a URL?

2006-10-13: Although the specification of the HTTP protocol does not specify any maximum length, practical limits are imposed by web browser and server software.

Microsoft Internet Explorer (Browser)

Microsoft states that the maximum length of a URL in Internet Explorer is 2,083 characters, with no more than 2,048 characters in the path portion of the URL. In my tests, attempts to use URLs 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 will work. I stopped testing after 100,000 characters.

Safari (Browser)

At least 80,000 characters will work. I stopped testing after 80,000 characters.

Opera (Browser)

At least 190,000 characters will work. I stopped testing after 190,000 characters. Opera 9 for Windows continued to display a fully editable, copyable and pasteable URL in the location bar even at 190,000 characters.

Apache (Server)

My early attempts to measure the maximum URL length in web browsers bumped into a server URL length limit of approximately 4,000 characters, after which Apache produces a "413 Entity Too Large" error. I used the current up to date Apache build found in Red Hat Enterprise Linux 4. The official Apache documentation only mentions an 8,192-byte limit on an individual field in a request.

Microsoft Internet Information Server (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::Daemon (Server)

Up to 8,000 bytes will work. Those constructing web application servers with Perl's HTTP::Daemon module will encounter a 16,384 byte limit on the combined size of all HTTP request headers. This does not include POST-method form data, file uploads, etc., but it does include the URL. In practice this resulted in a 413 error when a URL was significantly longer than 8,000 characters. This limitation can be easily removed. Look for all occurrences of 16x1024 in Daemon.pm and replace them with a larger value. Of course, this does increase your exposure to denial of service attacks.

Enjoy,

Robert C. Cartaino

Robert Cartaino
+3  A: 

< 2 cents>

If you have to ask, you're probably doing something wrong.

< /2 cents>

There are two possibilities here:

  1. The question really needs to have an answer of what the maximum URL is, because that is the only way that the person asking the question can pass information to the server. In this case, there are other good answers here, like one mentioning that IE is about 2080 characters long.
  2. The question doesn't need this answer, because the appropriate answer to this question, if it can be used by the person asking it, is to not pass a ton of information through the URL.

A URL is like an address to something, it's not the best way to pass information to something. A POST request is much more appropriate, if it can be used.

Lasse V. Karlsen
You're probably right, but that's doesn't actually answer the question. This would probably be better as a comment on the question rather than an answer.
Brian Sullivan
Let me expand on my answer then.
Lasse V. Karlsen
The question was mostly academic. I had already realized that a POST was more appropriate for my situation, but I thought this would be a good piece of information to know. The first few results on Google were not satifactorily exhaustive, and I didn't find the question on SO yet, so I thought I would ask. Although I do appreciate your concern for bad practice, I really just wanted an answer. Thankfully, I got a very useful one from Robert. Thanks!
Brian Sullivan
A: 

In case you want to be well-ranked in Google you should be aware of the fact that Google only indexes the first 7 words in any url after the domain name. Extremenly long URLs may be penalized. As a workaround you could use a service like tinyurl.com or implement a shortening scheme yourself. For example many PHP boards use a search like this:

  1. user types in the search form, postback to search.php
  2. redirect to search.php?searchid={guid} //notice that this is a get request. the guid identifies all search params the user has entered. but now the link to the search results can be shared and posted.