18

I am getting this error in my apache2 log:

[Tue Apr 06 09:00:56 2010] [error] [client A.B.C.D] request failed: URI too long (longer than 8190)

What setting can I change to increase this limit?

Roald Nefs
  • 1,302
  • 10
  • 29
kevin
  • 4,177
  • 10
  • 32
  • 33

6 Answers6

16

The best answer is "don't do that". See https://boutell.com/newfaq/misc/urllength.html (link goes to Internet Archive backup) for an explanation of why.

If you need to pass that much data, use POST, not GET.

Greg
  • 12,119
  • 5
  • 32
  • 34
Snowhare
  • 952
  • 5
  • 7
13

You would have to set DEFAULT_LIMIT_REQUEST_LINE constant inside of the Apache source code, and recompile Apache. This constant is in the httpd.h header file.

After this is done you can decrease request limit using the LimitRequestLine directive.

See the http://httpd.apache.org/docs/2.0/mod/core.html#limitrequestline for more info.

Roald Nefs
  • 1,302
  • 10
  • 29
Boris
  • 2,275
  • 20
  • 21
  • 2
    NB: This is only true in Apache 2.0 and earlier. Apache 2.2 and later (i.e, all modern versions of Apache) do not require code changes to increase `LimitRequestLine`. –  Jul 29 '19 at 02:10
12

Open /etc/apache2/apache2.conf

and insert under AccessFileName .htaccess:

LimitRequestLine 1000000
LimitRequestFieldSize 1000000
Roald Nefs
  • 1,302
  • 10
  • 29
Dhivin
  • 646
  • 6
  • 20
8

A quick hack to get it working you just edit the apache2.conf file and add the line:

LimitRequestLine 100000

Restart apache and you are all good. Although you should change the code to use POST instead of GET and remove the line as soon as you can.

Soth
  • 2,901
  • 2
  • 27
  • 27
3

I you use virtual hosts with Apache, you have to set LimitRequestLine and LimitRequestFieldSize within the first virtual host definition with a matching port. For Ubuntu/Debian this is in /etc/apache2/sites-available/000-default.conf.

It doesn't work if you set these parameters in /etc/apache2/apache2.conf.

Christian d'Heureuse
  • 5,090
  • 1
  • 32
  • 28
  • The only way I could get this to work was to insert into /etc/apache2/ports.conf # If you just change the port or add more ports here, you will likely also # have to change the VirtualHost statement in # /etc/apache2/sites-enabled/000-default.conf Listen 80 Listen 443 LimitRequestLine 1000000 LimitRequestFieldSize 1000000 Listen 443 other wise it was ignored – Andy Jul 22 '22 at 21:13
0

Increase the Apache limits for limit request line and limit request field size and save it.

Next step, Restart apache using sudo service apache2 restart

Hope, this will solve the problem.

Nikhil VJ
  • 5,630
  • 7
  • 34
  • 55
Rahul2692
  • 334
  • 1
  • 10