Using the
Transfer-Encoding: chunked
header, the server will send chunks of the rendered page back to the browser so in the case of Rails, it starts with the layout and sends out the<head>
part including assets like js and css.
Chunked transfer encoding is a great way to improve page performance for the parts of your application that require time-consuming database queries. The Rails-level changes are straightforward, but unfortunately not all Ruby web servers support the feature (looking at you, Puma).