3
votes

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!

1
Do you have threadsafe! enabled in your production environment config?Jesse Wolgamott
Yep, I do. Is that why Rack::Lock is not there in production?Oded
yep! no mutex/locking in threadsafe!Jesse Wolgamott

1 Answers

6
votes

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