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 with a long query string. You might also encounter this status code when a malicious user is trying to DoS your server by sending the 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

In Apache, you can change the default URI length by setting the LimitRequestLine in your /etc/apache2/apache2.conf file. By default, it is set to 8190 (in bytes).

LimitRequestLine 16000

Nginx

If you see lines like client sent too long header line or client sent too long URI while reading client request line in nginx error logs, 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 be larger than 8 kilobytes, and nginx may use 4 buffers at a time.

large_client_header_buffers 8 16K;

Technically, every request may take up to number times size amount of memory.

Trivia

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