1. Computing

Using Rack Middleware

By

3 of 4

Default Rack Middleware

By default, Rackup already adds on some middleware applications. Depending on whether the environment option is set to development, deployment or none, the following middleware applications will be running.

  • Development: CommonLogger, ShowExceptions, and Lint

  • Deployment: CommonLogger

  • None: none

Note that all the middleware that goes on to your application is a chain of middleware applications. In a application running in Rackup’s development configuration, a request is first passed to CommonLogger, then to ShowExceptions, then to Lint, and finally to your application. Further, these applications can either first pass the request down the chain and then do something to the response, do something to the request before passing it on, or both. Also, middleware doesn’t have to pass your application’s response back at all. For example, the Lint middleware will discard your response and pass an error message to the web server if something is wrong with your response.

©2014 About.com. All rights reserved.