3

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!

Oded
  • 233
  • 2
  • 9

1 Answers1

6

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
Jesse Wolgamott
  • 40,197
  • 4
  • 83
  • 109
  • 1
    Do you mean? `config.middleware.insert_before(Rack::Runtime, Rack::Rewrite) do` I'll check it out. – Oded Jul 20 '12 at 22:31