README.rdoc

Rack, a modular Ruby webserver interface

Rack provides a minimal, modular and adaptable interface for developing web
applications in Ruby. By wrapping HTTP requests and responses in the
simplest way possible, it unifies and distills the API for web servers, web
frameworks, and software in between (the so-called middleware) into a
single method call.

The exact details of this are described in the Rack specification, which
all Rack applications should conform to.

Supported web servers

The included handlers connect all kinds of web servers to Rack:

Mongrel

EventedMongrel

SwiftipliedMongrel

WEBrick

FCGI

CGI

SCGI

LiteSpeed

Thin

These web servers include Rack handlers in their distributions:

Ebb

Fuzed

Glassfish v3

Phusion Passenger (which is mod_rack for Apache and for nginx)

Puma

Rainbows!

Reel

Unicorn

unixrack

uWSGI

Zbatery

Any valid Rack app will run the same on all these handlers, without
changing anything.

Supported web frameworks

These frameworks include Rack adapters in their distributions:

Camping

Coset

Espresso

Halcyon

Mack

Maveric

Merb

Racktools::SimpleApplication

Ramaze

Ruby on Rails

Rum

Sinatra

Sin

Vintage

Waves

Wee

… and many others.

Available middleware

Between the server and the framework, Rack can be customized to your
applications needs using middleware, for example:

Rack::URLMap, to route to multiple applications inside the same process.

Rack::CommonLogger, for creating Apache-style logfiles.

Rack::ShowException, for catching unhandled exceptions and presenting them
in a nice and helpful way with clickable backtrace.

Rack::File, for serving static files.

…many others!

All these components use the same interface, which is described in detail
in the Rack specification. These optional components can be used in any
way you wish.

Convenience

If you want to develop outside of existing frameworks, implement your own
ones, or develop middleware, Rack provides many helpers to create Rack
applications quickly and without doing the same web stuff all over:

Rack::Request, which also provides query string parsing and multipart
handling.

Rack::Response, for convenient generation of HTTP replies and cookie
handling.

Rack::MockRequest and Rack::MockResponse for efficient and quick testing of
Rack application without real HTTP round-trips.

rack-contrib

The plethora of useful middleware created the need for a project that
collects fresh Rack middleware. rack-contrib includes a variety of add-on
components for Rack and it is easy to contribute new modules.

Contact

Please post security related bugs and suggestions to the core team at
<groups.google.com/group/rack-core>
or rack-core@googlegroups.com. This list is not public. Due to wide usage
of the library, it is strongly preferred that we manage timing in order to
provide viable patches at the time of disclosure. Your assistance in this
matter is greatly appreciated.

Copyright

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the “Software”),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.