Take the 2-minute tour ×

What is the maximum length of a URL in apache? Where is it documented, and is it configurable?

I'm implementing an openid identity provider, and would like to know the limitations I'm up against. I know about the 2048 byte path limit on Internet Explorer. That can be handled specially using user agent detection. Other browsers have much higher URL limits.

So what I'm interested in is apache server limits when coding an application.

share|improve this question
Duplicate: stackoverflow.com/questions/417142/… –  S.Lott Aug 17 '09 at 18:29
Not duplicate. But the referenced one from S.Lott is useful. OP is asking for specific server's limitations. –  maxwellb Aug 17 '09 at 19:13

5 Answers 5

up vote 44 down vote accepted

The default limit for the length of the request line is 8190 bytes (see LimitRequestLine directive). And if we subtract three bytes for the request method (i.e. GET), eight bytes for the version information (i.e. HTTP/1.0/HTTP/1.1) and two bytes for the separating space, we end up with 8177 bytes for the URI path plus query.

share|improve this answer
You're right. I tested it with Apache 2.2.11 and adjusting LimitRequestLine works well. For kicks, I've successfully used it with 128K urls. –  Stef Aug 17 '09 at 22:46
Did you have to recompile to use such large values? My version (2.2.15) silently ignores LimitRequestLine directives over 8190 unless recompiled with the added CFLAG "-D DEFAULT_LIMIT_REQUEST_LINE=16384" (then it allows up to 16384). –  sh-beta May 19 '10 at 17:33
Note that this is bytes; with urlencoded multibyte characters, it's rather easy to hit this limit (as a n-byte character takes n*3 bytes: becomes %E2%98%A2). –  Piskvor Feb 4 '11 at 10:15
  • Internet Explorer: 2,083 characters, with no more than 2,048 characters in the path portion of the URL
  • Firefox: 65,536 characters show up, but longer URLs do still work even up past 100,000
  • Safari: > 80,000 characters
  • Opera: > 190,000 characters
  • IIS: 16,384 characters, but is configurable
  • Apache: 4,000 characters

From: http://www.danrigsby.com/blog/index.php/2008/06/17/rest-and-max-url-size/

share|improve this answer

The official length according to the offical Apache docs is 8,192, but many folks have run into trouble at ~4,000.

MS Internet Explorer is usually the limiting factor anyway, as it caps the maximum URL size at 2,048.

share|improve this answer

Allowed size of URI is 8177 characters in GET request. Simple code in python for such testing.

#!/usr/bin/env python2

import sys
import socket

if __name__ == "__main__":
    string = sys.argv[1]
    buf_get = "x" * int(string)
    buf_size = 1024
    request = "HEAD %s HTTP/1.1\nHost:localhost\n\n" % buf_get
    print "===>", request

    sock_http = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    sock_http.connect(("localhost", 80))
    while True:
       print "==>", sock_http.recv(buf_size)
       if not sock_http.recv(buf_size):

On 8178 characters you will get such message: HTTP/1.1 414 Request-URI Too Large

share|improve this answer
That's the default length, changeable with the LimitRequestLine configuration directive. –  Stef Sep 15 '11 at 6:32

Here's a bash script to check the maximum limit of a remote server (uses curl and perl).

You just need some kind of an url that can be extended with 'x' and always return 200 (or adapt it to your needs). At some point it will break and the script will display the max length.

Here's the code:


while :; do
    echo trying with $length
    token=$(perl -le 'print "x"x'$times)
    result=$(curl -sLw '%{http_code}' -o /dev/null "${url}${token}")

    if [[ $result == 200 ]]; then
        if [[ $ok == $times ]]; then
            echo "max length is $length"
share|improve this answer

Your Answer


