The problem is that the Rails ActionController :: Streaming is displayed directly in the Chunked :: Body. This means that the content is first partitioned and then encrypted using the middleware Rack :: Deflater instead of gzipped and then placed.
According to HTTP / 1.1 RFC 6.2.1 , the packet should be the last encoding used for transmission.
Since "chunked" is the only transmission encoding that must be understood by HTTP / 1.1 recipients, it plays a crucial role in distinguishing between messages on a permanent connection. Whenever a transmission encoding is applied to a payload body in a request, the final transmission encoding applied must be โFragmentedโ.
I fixed this for us by decapitating ActionController :: Streaming _process_options and _render_template methods in the initializer so that it would not wrap the body in Chunked :: Body and would not allow the use of the Rack :: Chunked middleware instead.
module GzipStreaming def _process_options(options) stream = options[:stream]
And leave your config.ru as
require ::File.expand_path('../config/environment', __FILE__) use Rack::Chunked use Rack::Deflater run Roam7::Application
Not a very pleasant solution, it will probably break some other means that test / modify the body. If anyone has a better solution, I would like to hear it.
If you are using a new relic, its middleware should also be disabled when streaming .
source share