#50 ✓wontfix
Gaius Centus Novus

PATCH: Rack::Builder can now act as middleware

Reported by Gaius Centus Novus | May 29th, 2009 @ 04:17 AM

I want to apply certain middlewares only to some paths. I asked a question on StackOverflow, but haven't come up with any good solutions.

So I extended Rack::Builder to allow it to act like middleware. Thus, in a rackup file (or within another Builder):

use SomeMiddleware      # for all requests
use SomeOtherMiddleware # ditto
use Rack::Builder do
  map '/secret' do
    use Rack::Auth::Basic # Basic auth only for protected stuff
  end
end
run lambda { |env| ... }

This is particularly useful for Rails apps, which can add middlewares, but not endpoints, in their environment.rb.

There is a branch on GitHub, along with the relevant commit. I have also attached a patch file.

Comments and changes to this ticket

  • josh

    josh August 3rd, 2009 @ 03:38 PM

    • State changed from “new” to “wontfix”

    Rack::Builder is meant to be a Rack "app" not "middleware". Using "run Rack::Builder..." is the correct usage.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

People watching this ticket

Attachments

Pages