我目前有以下几个:
use Rack::Rewrite use Rack::Cache,{:verbose=>true,:Metastore=>"memcached://localhost:11211/rack-cache/Meta",:entitystore=>"memcached://localhost:11211/rack-cache/body"} use Rack::Rewrite use Rack::Lock use Rack::Deflater use ActionController::Failsafe use #<Class:0x007fb34be9ac90> use ActionController::Session::DalliStore,#<Proc:0x007fb34bea3638@(eval):8 (lambda)> use Rails::Rack::Metal use ActionController::ParamsParser use Rack::MethodOverride use Rack::Head use ActionController::StringCoercion use Sass::Plugin::Rack use Hassle use ActiveRecord::ConnectionAdapters::ConnectionManagement use ActiveRecord::QueryCache run ActionController::Dispatcher.new
我可能错了,但将Deflater移到顶部是不是有意义?这样,任何和所有流量都被gzip压缩.
谢谢您的帮助.
解决方法
最简单的插入方式是直接在你的config.ru中:
require ::File.expand_path('../config/environment',__FILE__) use Rack::Deflater run My::Application
确认它正在启动你的应用程序并用curl打它:
curl -i --head "Accept-Encoding: gzip,deflate" http://localhost:5000
哪个应该返回标题:
Vary: Accept-Encoding Content-Encoding: gzip
和一个精美的gziped响应.