HTTP/2 Support in Rack / Rails

ivanreese picture ivanreese · Oct 16, 2015 · Viewed 6.9k times · Source

HTTP/2 is released and supported by all major browsers. There are implementations shipping in major web servers like Apache and nginx.

But for us Rubyists, the choices are currently quite limited, it seems. Once upon a time (Dec 2014), Aaron Patterson was exploring ideas for supporting HTTP/2 in Rack 2.0, but that hasn't yet materialized. He's also posted a few gists with possibilities for Puma and WEBrick. That's all I've managed to find.

My question is, broadly: if I am interested in using HTTP/2 in a Rails app, what options exist, which features of HTTP/2 do they include, and are any of them ready for production?

Answer

Noah Gibbs picture Noah Gibbs · Oct 16, 2015

If you want to claim to support HTTP/2 for its own sake, you can just run NGinX with HTTP/2 and use a Ruby backend, roughly as normal (https://www.nginx.com/blog/how-nginx-plans-to-support-http2/). That won't give you HTTP/2-specific features like pushing assets from the server without a client request, though.

I believe it will give you the basic HTTP/2 feature you care about, multiple requests per connection (no slow-start) and muxing on a connection (don't need multiple connections.)

So that's nice.