Home

Awesome

Contributed Rack Middleware and Utilities

This package includes a variety of add-on components for Rack, a Ruby web server interface:

Use

Git is the quickest way to the rack-contrib sources:

git clone git://github.com/rack/rack-contrib.git

Gems are available too:

gem install rack-contrib

Requiring 'rack/contrib' will add autoloads to the Rack modules for all of the components included. The following example shows what a simple rackup (config.ru) file might look like:

require 'rack'
require 'rack/contrib'

use Rack::Profiler if ENV['RACK_ENV'] == 'development'

use Rack::ETag
use Rack::MailExceptions

run theapp

Versioning

This package is semver compliant; you should use a pessimistic version constraint (~>) against the relevant 2.x version of this gem.

This version of rack-contrib is compatible with rack 2.x and 3.x. If you are using rack 1.x, you will need to use rack-contrib 1.x. A suitable pessimistic version constraint (~>) is recommended.

Testing

To contribute to the project, begin by cloning the repo and installing the necessary gems:

gem install bundler
bundle install

To run the entire test suite, run:

bundle exec rake test

To run a specific component's tests, use the TEST environment variable:

TEST=test/spec_rack_thecomponent.rb bundle exec rake test

Criteria for inclusion

The criteria for middleware being included in this project are roughly as follows:

These criteria were introduced several years after the start of the project, so some of the included middleware may not meet all of them. In particular, several middleware have external dependencies. It is possible that in some future release of rack-contrib, middleware with external depencies will be removed from the project.

When submitting code keep the above criteria in mind and also see the code guidelines in CONTRIBUTING.md.

Links

Security Reporting

To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure.