Ruby, Sinatra and Closing Connections

rubysinatra

Does anyone know if there is a way to prevent Sinatra from sending the 'Connection: close' header in its responses?

To be clear, I have a very simple

get '/path' do
  puts "Some (~200 byte long) string"
end

But, after looking at the output in a network analyser, I see it's sending the Connection: close header right after the HTTP/1.1 200 OK, which I'd like to stop!

Best Answer

Ah ha! It seems Mongrel, the server my Sinatra app was running on, doesn't support Keep-Alive. so I just did:

set :server, 'thin'

after gem install thin and everything seems to be working better!