maximum length of HTTP GET request?

maximum length of http post request?
get request url length limit
http get response size limit
http put request body size limit
url get request length
http post size limit apache
url max length rest api
what is the max query string length

What's the maximum length of an HTTP GET request? Is there a response error defined that the server can/should return if it receives a GET request exceeds this length?

update: as indicated in the tags, this is in the context of a web service API, although it's interesting to see the browser limits as well.

The limit is dependent on both the server and the client used (and if applicable, also the proxy the server or the client is using).

Most webservers have a limit of 8192 bytes (8KB), which is usually configureable somewhere in the server configuration. As to the client side matter, the HTTP 1.1 specification even warns about this, here's an extract of chapter 3.2.1:

Note: Servers ought to be cautious about depending on URI lengths above 255 bytes, because some older client or proxy implementations might not properly support these lengths.

The limit is in MSIE and Safari about 2KB, in Opera about 4KB and in Firefox about 8KB. We may thus assume that 8KB is the maximum possible length and that 2KB is a more affordable length to rely on at the server side and that 255 bytes is the safest length to assume that the entire URL will come in.

If the limit is exceeded in either the browser or the server, most will just truncate the characters outside the limit without any warning. Some servers however may send a HTTP 414 error. If you need to send large data, then better use POST instead of GET. Its limit is much higher, but more dependent on the server used than the client. Usually up to around 2GB is allowed by the average webserver. This is also configureable somewhere in the server settings. The average server will display a server-specific error/exception when the POST limit is exceeded, usually as HTTP 500 error.

Maximum length of HTTP GET request, The limit is dependent on both the server and the client used (and if applicable, also the proxy the server or the client is using). Most web  Microsoft Internet Explorer has a maximum uniform resource locator (URL) length of 2,083 characters. Internet Explorer also has a maximum path length of 2,048 characters. This limit applies to both POST request and GET request URLs.If you are using the GET method, you are limited to a maximum of 2,048 characters, minus the number of characters in the actual path.

You are asking two separate questions here:

What's the maximum length of an HTTP GET request?

As already mentioned, HTTP itself doesn't impose any hard-coded limit on request length; but browsers have limits ranging on the 2kb - 8kb (255 bytes if we count very old browsers).

Is there a response error defined that the server can/should return if it receives a GET request exceeds this length?

That's the one nobody has answered.

HTTP 1.1 defines Status Code 414 Request-URI Too Long for the cases where a server-defined limit is reached. You can see further details on RFC 2616.

For the case of client-defined limits, there is no sense on the server returning something, because the server won't receive the request at all.

Hope this helps.

Limitations of the GET method in HTTP - Dropbox, clients and servers have a practical limit somewhere between 2 kB and 8 kB. What's the maximum length of an HTTP GET request? As already mentioned, HTTP itself doesn't impose any hard-coded limit on request length; but browsers have limits ranging on the 2kb - 8kb (255 bytes if we count very old browsers).

Browser limits are:

Browser     Address bar   document.location  
                          or anchor tag
------------------------------------------
Chrome          32779           >64k      
Android          8192           >64k                         
Firefox          >64k           >64k      
Safari           >64k           >64k      
IE11             2047           5120   
Edge 16          2047          10240

want more? see this question on Stack Overfollow

Can HTTP POST be limitless?, is limited to 2 MB on IIS 4.0, and 128 KB on IIS 5.0. IIS7(and later version) has a built-in request scanning which imposes an upload file cap which defaults to 30MB. To increase it, you also need to add the lines below: <

Similar question here: Is there a limit to the length of a GET request?

I've hit the limit and on my shared hosting account but the browser returned a blank page before it got to the server I think.

URL Too Long, be the maximum allowed size. The default size is 8KB. Specifies the maximum length of content in a request, in bytes. The default value is 30000000, which is approximately 28.6 MB maxQueryString : Optional uint attribute.

Technically I have seen HttpGet will have issue if the URL length goes beyond 2000 characters. In that case, it's better to use HttpPost or split the URL.

Tips to Handle Request/Response Size, If you are using the GET method, you are limited to a maximum of 2,048 characters, minus the number of characters in the actual path. However, the POST method is not limited by the size of the URL for submitting name and value pairs. Specifies the maximum length of content in a request, in bytes. The default value is 30000000, which is approximately 28.6MB. maxQueryString: Optional uint attribute. Specifies the maximum length of the query string, in bytes. The default value is 2048. maxUrl: Optional uint attribute. Specifies maximum length of the URL, in bytes. The default value is 4096.

URL character limit for Get requests, The HTTP specification doesn't impose a specific size limit for posts. They will usually be limited by either the web server or the programming technology used to  HTTP/1.1 206 Partial Content Content-Range: bytes 0-1023/146515 Content-Length: 1024 (binary content) The Content-Length header now indicates the size of the requested range (and not the full size of the image).

Is there a maximum size for content of an HTTP POST?, This limit applies to both POST request and GET request URLs. Protocol -- HTTP/1.1," does not specify any requirement for URL length. Various ad hoc limitations on request-line length are found in practice. It is RECOMMENDED that all HTTP senders and recipients support, at a minimum, request-line lengths of 8000 octets.

Maximum URL length is 2,083 characters in Internet Explorer, GET requests don't have a request body, so all parameters must appear in the URL or in a header. While the HTTP standard doesn't define a limit  This limit applies to both POST request and GET request URLs. If you are using the GET method, you are limited to a maximum of 2,048 characters, minus the number of characters in the actual path. However, the POST method is not limited by the size of the URL for submitting name/value pairs. These pairs are transferred in the header and not in the URL. RFC 2616, "Hypertext Transfer Protocol -- HTTP/1.1," does not specify any requirement for URL length.

Comments
  • possible duplicate of What is the maximum length of a URL?
  • @KillianDS It has absolutely nothing whatsoever to do with the maximum length of a URL. The question is about the maximum length of a request that is sent to a URL.
  • @EJP the 'data' contents of a GET is not more then a URI.
  • @JimAho your comment is a duplicate of the first comment too.....
  • You answer the question in terms of browser limitations. Do you know if there are any differences between GET and POST (in terms of problematic request size) if, say, HttpClient is used to interact with a REST server?
  • Sure, POST use the body to send the data. The HTTP specification doesn't impose a specific size limit for posts.
  • It's perfectly allowed by the Http specs to put a body in GET and DELETE requests. I've tested it in Java, and it works. Unfortunately here again some proxys could cut the full body.
  • Get and Post method has a very specific meaning, so using a POST to perform a GET is the same as using as using a hammer to break an egg.
  • @nohros That's idealistically true, but GET also has limitations that POST/PUT do not. For example, suppose you want to perform a very long query involving a bunch of ids; if you're selecting on hundreds of ids, that can breach the limit of the allowable URL size, whereas putting that query in a POST can avoid that, even if it doesn't make as much sense conceptually. Personally, I wish HTTP allowed GET requests to have bodies just like PUT and POST.