Building notes, projects, and occasional rants

Lighttpd, file uploads and Safari

On one of the web applications I have, the setup is more or less like this:

In this case, lighttpd is used as a reverse HTTP proxy to Apache, using mod_proxy.

I was trying to get file uploads to work on this setup. Uploading directly to Apache works flawlessly, but via mod_proxy, Safari would hang at the end, never terminating the request.

The solution is simple: for now, just disable keep-alives. Add this to your Lighttpd virtual host configuration:

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

Given that this is a back-office, this is acceptable, but for other situations it might not be. I must try to target this just to file uploads, even if that means moving them to a special virtual host.