Strange issue with Rails middleware, Warden and missing path paremeters

Hey,

this started as OmniAuth issue and is pretty well document here: https://github.com/intridea/omniauth/issues/#issue/239/comment/917065

If you have a bare Rails app with Devise gem (Warden itself would probably be enough), add the following middleware to simulate OmniAuth behavior:

class BreakApp def initialize(app) @app = app end

def call(env) @app.call(env.dup) # call 1 @app.call(env) # call 2 end end

and call Warden in ApplicationController before_filter e.g.:

request.env[‘warden’].authenticate(:scope => :user)

then params[:controller] and params[:action] are missing.

If you remove the before filter or change the first call in the middleware to @app.call(env) (without #dup) it works fine. I prepared a sample app to show this issue: https://github.com/szimek/omniauth_dynamic_providers_bug

I have no idea if this issue is caused by Rails or Warden code. Any ideas why path parameters are missing and how to fix it are welcome :slight_smile:

Cheers,

Szymon