How to Increase Max URL Length in Apache


increase max url length in apache

By default, Apache supports up to 8190 byte long URLs. If you run into errors due to long URLs, here’s how to increase max URL length in Apache.

 

What is the maximum URL length in Apache?

Although the default maximum URL length in Apache is 8,190 bytes, many users face problems with 4,000 characters itself. In fact, Internet Explorer limits URLs to 2,048 bytes. Other browsers support longer URL’s

  • Internet Explorer: 2,083 characters
  • Firefox: 65,536 characters
  • Safari: > 80,000 characters
  • Opera: > 190,000 characters
  • IIS: 16,384 characters, but is configurable
  • Apache: 4,000 characters

So if most of your users use Firefox/Chrome then it might be a good idea to increase max URL in Apache.

 

How to Increase Max URL Length in Apache

Here are the steps to increase max URL length in Apache.

Apache allows you to set the limit on allowed size of URL length that will be accepted from the clients, using LimitRequestLine directive. Its default value is 8190.

Here’s the syntax:

LimitRequestLine bytes

 

If you want to decrease it to, say, 4000 bytes

LimitRequestLine 4000

 

If you want to increase it to 10,000

LimitRequestLine 10000

 

Paste the above code in Apache’s config file, present at one of the following locations, depending on your linux

  • /etc/apache2/httpd.conf
  • /etc/apache2/apache2.conf
  • /etc/httpd/httpd.conf
  • /etc/httpd/conf/httpd.conf

 

Restart Apache Server to apply changes


$ sudo systemctl restart apache2 [Ubuntu/Debian]
$ sudo systemctl restart httpd [RHEL/CentOS]

 

Although, you can increase max URL length in Apache, it is not advisable to do so because:

  1. Long URLs are seen as abnormal client behavior and limiting them can be an effective to avoid denial-of-service attacks.
  2. Instead of sending all your data via GET requests, and increasing URL length, it is advisable to use POST, instead of GET requests, to send lot of data.

About Sreeram Sreenivasan

Sreeram Sreenivasan is the Founder of Ubiq, a business dashboard & reporting platform for small & medium businesses. Ubiq makes it easy to build business dashboards & reports for your business. Try it for free today!