Project

General

Profile

[Solved] 413 - Request Entity Too Large

Added by zuan.private over 5 years ago

Hi all,

we are using lighttpd with mod_proxy in front of a python backend on an embedded system (ARM926EJ-S) with Linux.
lighttpd directly serves files and forwards app requests to our python backend.

We prevoiusly used an older version of lighttpd (1.4.28) and now want to use the latest release (1.4.50) but struggle with an issue:

When we try to GET our static webpage (index.html) we get "413 - Request Entity Too Large" instead of our content (a simple test page indicating that the webserver is running correctly).

So I activated the server log and got the following Messages:

2018-09-19 13:26:35: (server.c.1430) server started (lighttpd/1.4.50)
2018-09-19 13:27:12: (response.c.434) request-size too long: 0 -> 413
2018-09-19 13:31:46: (response.c.434) request-size too long: 0 -> 413

I currently use the same configuration file I used with 1.4.28:

server.modules = (
  "mod_setenv",
  "mod_expire",
  "mod_access",
  "mod_rewrite",
  "mod_auth",
  "mod_proxy",
  "mod_accesslog" 
)

server.tag                  = "Lighttpd/1.4.50" 
server.username             = "ftp" 
server.groupname            = "ftp" 
server.errorlog-use-syslog  = "disable" 
accesslog.use-syslog        = "enable" 
accesslog.format            = "%h %t \"%r\" %>s %b" 
server.bind                 = "0.0.0.0" 
server.port                 = 80
server.document-root        = "/srv" 
server.upload-dirs          = ( "/var/cache/lighttpd/uploads" )
server.max-request-size     = 2100000
server.network-backend      = "writev" 
server.pid-file             = "/var/run/lighttpd.pid" 
index-file.names            = ( "index.html" )
server.errorlog             = "/srv/lighttpd.log" 

setenv.add-response-header = ( "Access-Control-Allow-Origin" => "*" )

url.access-deny             = ( )

static-file.exclude-extensions = ( )

dir-listing.encoding        = "utf-8" 
server.dir-listing          = "enable" 

#compress.cache-dir          = "/var/cache/lighttpd/compress/" 
#compress.filetype           = ( "application/x-javascript", "text/css", "text/html", "text/plain" )

# mimetype mapping
mimetype.assign   = (
  ".pdf"    =>  "application/pdf",
  ".sig"    =>  "application/pgp-signature",
  ".spl"    =>  "application/futuresplash",
  ".class"  =>  "application/octet-stream",
  ".ps"   =>  "application/postscript",
  ".torrent"  =>  "application/x-bittorrent",
  ".dvi"    =>  "application/x-dvi",
  ".gz"   =>  "application/x-gzip",
  ".pac"    =>  "application/x-ns-proxy-autoconfig",
  ".swf"    =>  "application/x-shockwave-flash",
  ".tar.gz" =>  "application/x-tgz",
  ".tgz"    =>  "application/x-tgz",
  ".tar"    =>  "application/x-tar",
  ".zip"    =>  "application/zip",
  ".mp3"    =>  "audio/mpeg",
  ".m3u"    =>  "audio/x-mpegurl",
  ".wma"    =>  "audio/x-ms-wma",
  ".wax"    =>  "audio/x-ms-wax",
  ".ogg"    =>  "audio/x-wav",
  ".wav"    =>  "audio/x-wav",
  ".gif"    =>  "image/gif",
  ".jpg"    =>  "image/jpeg",
  ".jpeg"   =>  "image/jpeg",
  ".png"    =>  "image/png",
  ".xbm"    =>  "image/x-xbitmap",
  ".xpm"    =>  "image/x-xpixmap",
  ".xwd"    =>  "image/x-xwindowdump",
  ".css"    =>  "text/css",
  ".html"   =>  "text/html",
  ".htm"    =>  "text/html",
  ".js"   =>  "text/javascript",
  ".asc"    =>  "text/plain",
  ".c"    =>  "text/plain",
  ".conf"   =>  "text/plain",
  ".text"   =>  "text/plain",
  ".txt"    =>  "text/plain",
  ".dtd"    =>  "text/xml",
  ".xml"    =>  "text/xml",
  ".mpeg"   =>  "video/mpeg",
  ".mpg"    =>  "video/mpeg",
  ".mov"    =>  "video/quicktime",
  ".qt"   =>  "video/quicktime",
  ".avi"    =>  "video/x-msvideo",
  ".asf"    =>  "video/x-ms-asf",
  ".asx"    =>  "video/x-ms-asf",
  ".wmv"    =>  "video/x-ms-wmv",
  ".bz2"    =>  "application/x-bzip",
  ".tbz"    =>  "application/x-bzip-compressed-tar",
  ".tar.bz2"  =>  "application/x-bzip-compressed-tar" 
)

#
## Expire rules (mod_expire)
#
## Rules for URLs when a client cache expires
#

#
## WebDAV
#
# Enable WebDAV for all URLs except /records and /system
#
server.modules += ( "mod_webdav" )
$HTTP["url"] !~ "^/(records|system)([/\?].*|$)" {
  webdav.activate = "enable" 
  webdav.is-readonly = "disable" 
  webdav.sqlite-db-name = "/var/run/lighttpd.webdav_lock.db" 
}

#
## Proxy POST,PUT,DELETE /records to Spooler
#
$HTTP["request-method"] == "POST" {
    $HTTP["url"] =~ "^/records([/\?].*|$)" {
        proxy.server  = ( "" =>
            (( "host" => "127.0.0.1", "port" => 8081 ))
        )
    }
}
$HTTP["request-method"] == "PUT" {
    $HTTP["url"] =~ "^/records([/\?].*|$)" {
        proxy.server  = ( "" =>
            (( "host" => "127.0.0.1", "port" => 8081 ))
        )
    }
}
$HTTP["request-method"] == "DELETE" {
    $HTTP["url"] =~ "^/records([/\?].*|$)" {
        proxy.server  = ( "" =>
            (( "host" => "127.0.0.1", "port" => 8081 ))
        )
    }
}

#
## Proxy GET /records/jobs to Spooler
#
$HTTP["request-method"] == "GET" {
    $HTTP["url"] =~ "^/records/jobs([/\?].*|$)" {
        proxy.server  = ( "" =>
            (( "host" => "127.0.0.1", "port" => 8081 ))
        )
    }
}

#
## Proxy GET /records to DB-Server
#
$HTTP["request-method"] == "GET" {
    $HTTP["url"] =~ "^/records(?!/jobs([/\?].*|$))([/\?].*|$)" {
        proxy.server  = ( "" =>
            (( "host" => "127.0.0.1", "port" => 8082 ))
        )
    }
}

#
## Proxy /system to System-Server
#
$HTTP["url"] =~ "^/system([/\?].*|$)" {
    proxy.server  = ( "" =>
        (( "host" => "127.0.0.1", "port" => 8080 ))
    )
}

Can somebody give me a hint where to look to solve this problem?

Thanks in advance,
Andi


Replies (2)

RE: [Solved] lighttpd 413 - Request Entity Too Large - Added by gstrauss over 5 years ago

lighttpd 1.4.28 was released of 8 years ago. That's really old.

server.max-request-field-size - maximum size of the request header (in bytes)

Since lighttpd 1.4.42, the default value was reduced from 64k to 8k.

RE: [Solved] 413 - Request Entity Too Large - Added by zuan.private over 5 years ago

Thank you very much, that was exactly the hint I was looking for.

Now it works like a charm. :)

    (1-2/2)