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 that exceeds this length?
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 servers and clients have a limit of 8192 bytes (8 KB), which is usually configurable somewhere in the server or client settings. The HTTP specification recommends 8000 octets in section 4.1:
But this is thus not required. The limit is generally lower in older clients. For example Internet Explorer had a limit of about 2 KB. The previous version of the HTTP specification even literally states the following:
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 an HTTP 414 ‘URI Too Long’ 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 4 GB is allowed by the average web server. This is also configurable somewhere in the server settings. The average server will display a server-specific error/exception when the POST limit is exceeded, usually as an HTTP 500 error.