Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTTP/2 Support in Rack / Rails

Tags:

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?

like image 930
ivanreese Avatar asked Oct 16 '15 17:10

ivanreese


People also ask

Does HTTP support http2?

In browsers, HTTP/2 is supported by the most current releases of Edge, Safari, Firefox and Chrome. Other browsers based upon Blink will also support HTTP/2 (e.g., Opera and Yandex Browser).

Is http 2 backward compatible?

Browser Compatibility: HTTP/2 is compatible with almost all browsers and is backward compatible with previous protocol versions like HTTP/1.1.


1 Answers

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.

like image 169
Noah Gibbs Avatar answered Oct 20 '22 00:10

Noah Gibbs