Search code examples
ruby-on-railsmongrel

"You are being redirected" bug in Rails 2.3.8 + mongrel


We've recently upgraded Rails to 2.3.8 (from something so ancient you don't wanna know).

Everything was going fine and everything worked just fine in development, then when we put it up on staging we discovered that redirections suddenly stopped working.

Instead of being redirected (say during login) we just got a blank page that says "You are being redirected".

If you click on the work "redirected" you'd get to the page you were after, but it never would actually redirect.


Solution

  • This seems to be a bug in mongrel as described here: https://rails.lighthouseapp.com/projects/8994/tickets/4690

    The solution is provided as a file you can just drop right into config/initializers here: http://gist.github.com/471663

    Which didn't work for us at first. It came up with a bug about requirements:

    ArgumentError: Illformed requirement [#<Gem::Requirement:0x2ac6e72be9a8 @requirements=[["~>", #<Gem::Version "1.1.5">]], @version=nil>]
    

    But I just removed the requirements line from the mongrel.rb file (after all, I know I'm running mongrel v 1.1.5) so from:

    if Rails.version == '2.3.8' && Gem.available?('mongrel', Gem::Requirement.new('~>1.1.5')) && self.class.const_defined?(:Mongrel)
    

    it became simply:

    if Rails.version == '2.3.8'
    

    This fixed the redirection problem.