414 Request-URI Too Large
The HTTP 414 URI Too Long response status code indicates that the URI(Uniform Resource Identifier) requested by the client is longer than the server is willing to interpret.
To resolve this problem :
- By POST request: Convert query string to json object and sent to API request with POST.
- By GET request: Max length of request is depend on sever side as well as client side. Most webserver have limit 8k which is configurable. On the client side the different browser has different limit. The browser IE and Safari limit to 2k, Opera 4k and Firefox 8k. This means that the max length for the GET request is 8k and min request length is 2k.
A URL (Uniform Resource Locator) is a specific character string that constitutes a reference to a resource. There is really no universal maximum URL length . Although the specification of the HTTP protocol does not specify any maximum length, practical limits are imposed by web browser and server software, which varies widely. Extremely long URLs are usually a mistake. If you keep URLs under 2000 characters , they'll work in virtually any combination of client and server software.
Possible causes of 414 Request-URI Too Long
- POST to GET : Converting a POST request to a GET request with query information that is too long.
- A redirect loop: If you get into a redirect loop, the resulting URLs get too long, and the error will appear.
- Server Attack : The server is under attack by a client attempting to exploit potential security holes.
If exceed the request max length then the request truncated outside the limit by web server or browser without any warning. Some server truncated request data but the some server reject it because of data lose and they will return with response code 414 Request URI Too Large.
URI character limit
URI actually have a character limit depending on several things. Chrome limits url length of 2MB (2,097,152 characters) for practical reasons and to avoid causing denial-of-service problems in inter-process communication. On most platforms, Chrome's omnibox limits URL display to 32kB ( kMaxURLDisplayChars ) although a 1kB limit is used on VR platforms. IE - 2083 characters, Firefox - 2047 characters, Safari 80000 characters and Opera 190,000 characters.
How to solve 414 Request URI Too Large in Apache
- Open Apache Configuration File
- Increase URI limit
- Restart Apache web server
This problem might be caused by the Apache limits the set a size of a client's HTTP request-line and the HTTP request header field size. Under Apache, the limit is a configurable value, LimitRequestLine. Change this value to something larger than its default of 8190 if you want to support a longer request URI.
Open Apache Configuration File
Open terminal and run the following command to open Apache configuration page.
It is important to note that Apache configuration file is located depending on your Linux distribution. Moreover, if you make changes in Apache server configuration file, it will be applicable for all websites/domains that you run on your Apache web server.
Increase URI limit
Under Apache, the limit is a configurable value, LimitRequestLine. If you want to increase URL limit to 5000 characters (bytes), add the following lines to your server configuration or virtual host file.
If you want to increase maximum header length supported by Apache to 3000 characters, then add the following line.
Restart Apache web server
Now you can restart Apache web server to apply changes.
NEXT.....Message channel closed before a response was received