Heroku + Rack-Rewrite
问题 Still can't get this working...Rails 3.1.3, Ruby 1.9.2 on Heroku's Cedar Stack. Trying to use https://github.com/jtrupiano/rack-rewrite to make http://domain 301 redirect to http://www.domain to no luck (app works, but no redirects happen at all). /config/initializers/rack_rewrite.rb (MyAppName is actually the correct name, domain.com is actual domain): MyAppName::Application.config.middleware.insert_before(Rack::Lock, Rack::Rewrite) do r301 %r{.*}, 'http://www.domain.com$&', :if => Proc.new