Question

I'm trying to set up rack-rewrite for a Rails 3.2.3 on Heroku cedar stack and everywhere I look it says to add something like:

config.middleware.insert_before(Rack::Lock, Rack::Rewrite) do
  # rewrite rules
end

But trying to run this on Heroku gives me the error:

`assert_index': No such middleware to insert before: Rack::Lock (RuntimeError)

and indeed running "heroku rake middleware" doesn't show Rack::Lock on the list while in development Rack::Lock is there.

First question is why Rack::Lock is not present on Heroku, is that correct? Second question, if not before Rack::Lock, where should I insert Rack::Rewrite?

Thanks!

Was it helpful?

Solution

If you use threadsafe! enabled in production, there is no Rack::Lock... so instead:

config.middleware.insert_before(Rack::Runtime, Rack::Rewrite) do
  #your coolness here
end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top