views:

25

answers:

1

To fix issues with Safari frequently hanging when uploading files, I need to make a request to my Rails server and have it return an empty body with a "Connection: close" header. More details about this fix can be found here.

So far, I have tried:

def close
  return head :ok, {'Connection' => 'close'}
end

def close
  response.headers['Connection'] = 'close'
  render :nothing => true
end

def close
   response.headers['Connection'] = 'close'
   return head :ok
end

None of these approaches seem to work. Inspecting the request in Firebug and Safari's developer console reveals that the response header, Connection, is always set to "keep-alive"

I'm running Rails 2.3.5 with Mongrel and Nginx. Setting a header such as Content-Type does work by the way.

Any ideas on how to fix this?

A: 

So I never figured out how to do this in Rails, but I did find out that nginx version 0.7.66+ disables keepalive connections for Safari. See the nginx changelog.

So I upgraded my nginx and all is well with Safari now.

Coomer