414 Request-URI Too Long

HTTP 414 status code indicates that a server refuses to process a request because the URI is too long.

This error might occur when the POST request was (incorrectly) converted to the GET request creating a long query string. You might also encounter this status code when a malicious user is trying to DoS your server by sending a long URI.

While HTTP 1.1 spec doesn’t mandate any hard limits concerning the URI length, most browsers set the limit of low thousands of characters.

In most cases, you don’t need to increase the URI length limit. However, some web servers do allow you to increase the default limit.

Apache

You can increase the maximum allowed URI length in Apache by changing the LimitRequestLine config in your /etc/apache2/apache2.conf file. By default, Apache accepts URIs up to 8190 bytes.

LimitRequestLine 16000

Nginx

If your nginx error logs contain client sent too long URI while reading client request line, it means the request URL has exceeded the allowed limit.

In nginx, the maximum allowed URI length is defined by the large_client_header_buffers parameter, which consists of two values: number and size of buffers. It defaults to 4 8k, which means the size of a single buffer can’t exceed 8 kilobytes, and nginx may use 4 buffers at a time.

large_client_header_buffers 8 16K;

It means each request may take up to a number times size amount of memory (128k in the above example).

Trivia

Due to the backward compatibility requirements, Apple platforms (e.g., macOS, iOS) can accept URIs up to 2 gigabytes of size.