File upload works with webrick, but fails in lighttpd 1.4.11


#1

I’ve been trying to add a basic file upload feature (just based on the
Rails Recipes example), but I find that it only works with the webrick
server and not my lighttpd 1.4.11 server.

I’m running Rails 1.1.2 on OSX. The upload silently fails with both
firefox and Safari, even with the useragent hack and with any size of
file/image. My lighttpd config is pretty standard as shown below. Any
ideas/help? TIA

server.port = 3000
server.modules = ( “mod_rewrite”, “mod_accesslog”,
“mod_fastcgi” )
server.error-handler-404 = “/dispatch.fcgi”
server.document-root = CWD + “/public/”

server.errorlog = CWD + “/log/lighttpd.error.log”
accesslog.filename = CWD + “/log/lighttpd.access.log”
url.rewrite = ( “^/$” => “index.html”, “^([^.]+)$” =>
“$1.html” )

Change *-procs to 2 if you need to use Upload Progress or other tasks

that

need to execute a second request while the first is still pending.

fastcgi.server = ( “.fcgi” =>
( “localhost” =>
(
“min-procs” => 2,
“max-procs” => 2,
“socket” => CWD + “/tmp/sockets/fcgi.socket”,
“bin-path” => CWD + “/public/dispatch.fcgi”,
“bin-environment” => ( “RAILS_ENV” => “development” )
)
)
)

mimetype.assign = (
“.css” => “text/css”,
“.gif” => “image/gif”,
“.htm” => “text/html”,
“.html” => “text/html”,
“.jpeg” => “image/jpeg”,
“.jpg” => “image/jpeg”,
“.js” => “text/javascript”,
“.png” => “image/png”,
“.swf” => “application/x-shockwave-flash”,
“.txt” => “text/plain”
)

Making sure file uploads above 64k always work when using IE or Safari

For more information, see http://trac.lighttpd.net/trac/ticket/360

$HTTP[“useragent”] =~ “^(.MSIE.)|(.AppleWebKit.)$” {
server.max-keep-alive-requests = 0
}