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:
If you want to decrease it to, say, 4000 bytes
If you want to increase it to 10,000
Paste the above code in Apache’s config file, present at one of the following locations, depending on your linux
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:
- Long URLs are seen as abnormal client behavior and limiting them can be an effective to avoid denial-of-service attacks.
- 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.