Strange issue with Rails middleware, Warden and missing path paremeters


this started as OmniAuth issue and is pretty well document here:

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

def call(env) # call 1 # call 2

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 (without #dup) it works fine. I prepared a sample app to show this issue:

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: