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 for several reasons:

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.

Overwhelmingly, this happens when someone misuses GET requests to send form data encoded in a large query string. In such instances, it’s better to stick to POST requests unless you have a very good reason not to. Most web servers do allow you to increase the default limit if you want to accommodate such use cases.

Apache

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

LimitRequestLine 128000

Nginx

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

In nginx, the maximum allowed URI length is defined by the large_client_header_buffers directive, which consists of two values: number and size of buffers. It defaults to 4 8k, which means Nginx caps each request line to 8 kilobytes.

large_client_header_buffers 4 128K;

If you still get 414 responses from Nginx, keep increasing the buffer size (the second part, 16K in the above example). Don’t forget to reload/restart your server(s) each time you change a config.

Trivia

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

Interested in no-nonsense technical guides?

No spyware, no promotional emails, or keyword-stuffed junk. I will only send you a single email when I've got something interesting to say. Unsubscribe anytime.

You can also subscribe to the Atom feed (it's like RSS, but better).