Solved

Is there a restriction on the size of a URL/Query string?

Posted on 2001-08-02
6
226 Views
Last Modified: 2013-12-25
Hi,

I have come across web servers that truncate the query parameters present in the url (e.g. http://mypage.com/myPage.jsp?arg1=23&arg2=45) if the whole string exceeds a size limit?

Is there any such limit in HTTP protocol, if yes what is the limit and where is it defined?  Has anybody experienced such stuff?  Is it a browser problem, if yes, do IE and NN both do that?

I would really appreciate a quick response.

Thanks,

KM
0
Comment
Question by:kmahmood
6 Comments
 
LVL 18

Expert Comment

by:mgfranz
ID: 6350500
It depends on how the data is passed to the page, if the <form> field uses POST, then the limit is 254 characters.  GET allows something like 64k.

I do not recommend passing anything more that 254 characters in the URL string, more than that can cause a bind on the server.  If you have to, use Sessions, Cookies, or hidden field parameters instead.

IE is a little more forgiving than NN, (not sure about NN6 though).
0
 
LVL 1

Accepted Solution

by:
gordonmcmullan earned 20 total points
ID: 6400215
Hi,

I think you have this the wrong way round.

GET requests should be kept below 255 characters.

A GET request is encoded into the URL submitted to a server whilst a POST request is contained in the data section of the request.

There are some browsers, proxies, caches, etc out there that truncate URL's over 255 characters, thus affecting the GET request. If you are expecting to exceed 255 characters in your data then use POST when submitting your request. (note: URL encoding for characters not allowed in URLs may increase the size of the URL you need)

This does have a downside as the request is no longer bookmarkable.

255 characters gives a fairly long string is this the limit you are seeing?

Gordon McMullan
0
 
LVL 18

Expert Comment

by:mgfranz
ID: 6400458
DOH, your right... Thanks Gordon.
0
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 
LVL 5

Expert Comment

by:raizon
ID: 6450793
The HTTP protocol itself doesn't restrict the limit the size of the query string.  Its the browsers that do.  IE limits it to essentially 3k, where with Netscape I havn't been able to find any information on what the limit is.
0
 
LVL 18

Expert Comment

by:bruno
ID: 6840817
Hello,

This question has been open for quite a while now and needs to be wrapped up.

Please do NOT accept this comment as an answer, as I am simply trying to alert those involved that the
question is still open.

If any of the experts could come back and post any suggestions as to how they feel this could be wrapped
up (delete, 0 PAQ, award points, etc), I'm sure the moderators would appreciate it.

Thank you,

BRUNO
0
 
LVL 5

Expert Comment

by:raizon
ID: 6841578
I vote for a delete.  There really isn't any information worth  a 0 PAQ.  Either that or split the points between gordon and mgfranz
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question