Clone this wiki locally
This page is up to date for Rango 0.1.
All Rango middlewares are located in
Rango::Basic is the basic and most important Rango middleware. It should be used in all Rango applications. It set up serving of static files, cookies, content length, content type and rewritting to proper HTTP method if
Rango::Static can serve static files even if they haven’t specific URL prefix. This middleware is automatically used by
Rango::Encoding forces your default encoding for Rack env. This middleware is automatically used by
Rango::EmailObfuscator for all
text/htmldocuments replaces all
<body>by it’s entity, to prevent spam robots to find your email. It’s easy, but surprisingly powerful technique.
- Rack::Head Drop the body of the response on HEAD requests.
- Rack::Deflater – gzip your responses.
- Rack::ConditionalGet – enables conditional GET using If-None-Match and If-Modified-Since.
- Rack::Session::Cookie and Rack::Session::Memcache – provide session management.
- Rack::Auth::Basic – implements HTTP Basic Authentication.
- Rack::URLMap is simple router useful for applications with very simple routing rulez, webservices etc. See section routers.
- Rack::MethodOverride Override REQUEST_METHOD with _method post params for HTML forms.
Rack contrib project
(The description bellow was stolen from README in rack-contrib)
- Rack::ETag – Automatically sets the ETag header on all String bodies.
- Rack::JSONP – Adds JSON-P support by stripping out the callback param and padding the response with the appropriate callback format.
- Rack::LighttpdScriptNameFix – Fixes how lighttpd sets the SCRIPT_NAME and PATH_INFO variables in certain configurations.
- Rack::Locale – Detects the client locale using the Accept-Language request header and sets a rack.locale variable in the environment.
- Rack::MailExceptions – Rescues exceptions raised from the app and sends a useful email with the exception, stacktrace, and contents of the environment.
- Rack::NestedParams – parses form params with subscripts (e.g., * “post[title]=Hello”) into a nested/recursive Hash structure (based on Rails’ implementation).
- Rack::PostBodyContentTypeParser – Adds support for JSON request bodies. The Rack parameter hash is populated by deserializing the JSON data provided in the request body when the Content-Type is application/json.
- Rack::ProcTitle – Displays request information in process title ($0) for monitoring/inspection with ps(1).
- Rack::Profiler – Uses ruby-prof to measure request time.
- Rack::Sendfile – Enables X-Sendfile support for bodies that can be served from file.
- Rack::Signals – Installs signal handlers that are safely processed after a request
- Rack::StaticCache – Modifies the response headers to facilitiate client and proxy caching for static files that minimizes http requests and improves overall load times for second time visitors.
- Rack::Evil – Lets the rack application return a response to the client from any place.
- Rack::Callbacks – Implements DLS for pure before/after filter like Middlewares.
- Rack::Config – Shared configuration for cooperative middleware.
- Rack::NotFound – A default 404 application.
- Rack::CSSHTTPRequest – Adds CSSHTTPRequest support by encoding responses as CSS for cross-site AJAX-style data loading
- Rack::Deflect – Helps protect against DoS attacks.
- Rack::ResponseCache – Caches responses to requests without query strings to Disk or a user provider Ruby object. Similar to Rails’ page caching.
- Rack::RelativeRedirect – Transforms relative paths in redirects to absolute URLs.
- Rack::Backstage – Returns content of specified file if it exists, which makes it convenient for putting up maintenance pages.
- Rack::AcceptFormat – Adds a format extension at the end of the URI when there is none, corresponding to the mime-type given in the Accept HTTP header.
- Rack::HostMeta – Configures /host-meta using a block
- Rack::Cookies – Adds simple cookie jar hash to env
- Uploads middleware
- Rack rewrite Rack middleware for request rewriting
- HTML Tidy middleware
- Middleware for showing Git/SVN revision
- Rack::Cache, also see Rack::Cache announce
- Rack::CacheWhileRevalidate Works with Rack::Cache to serve up stale data while silently revalidating
- Rack::Regenerate Rack middleware for periodic cache regeneration
- CloudKit includes OpenIDFilter, OAuthFilter, and RESTful JSON storage
“http://blog.tie-rack.org/2009/3/27/Using-Rack-Middleware-to-Modify-the-Request-Environment.html”: Detect mobile device