Low commit activity in last 3 years
No release in over a year
Detect and show a maintenance page
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 2.0

Runtime

>= 2.1.4
>= 12.3.3
 Project Readme

rack-maintenance¶ ↑

Rack::Maintenance is a simple Rack middleware to detect the existence of a maintenance page and display that instead of incoming requests.

<img src=“https://travis-ci.org/tilsammans/rack-maintenance.svg?branch=master” alt=“Build Status” />

Installation¶ ↑

sudo gem install rack-maintenance

Installation with Bundler¶ ↑

In Gemfile:

gem 'rack-maintenance'

and then run ‘bundle`.

Usage¶ ↑

# html maintenance response
config.middleware.use 'Rack::Maintenance',
  :file => Rails.root.join('public', 'maintenance.html'),
  :env  => 'MAINTENANCE'

# json maintenance response
# it's up to you to provide a valid JSON file!
config.middleware.use 'Rack::Maintenance',
  :file => Rails.root.join('public', 'maintenance.json'),
  :env  => 'MAINTENANCE'

# You may provide an object that responds to call to provide
# post-processing of the maintenance page such as merging
# ENV values into the page through ERB
config.middleware.use 'Rack::Maintenance',
  :file => Rails.root.join('public', 'maintenance.html.erb'),
  :env  => 'MAINTENANCE',
  :processor => lambda { |content| ERB.new(content).result }

If :env is specified, all requests will be shown the maintenance page if the environment variable is set.

If :env is not specified, the maintenance page will be shown if it exists.

# Leave some paths enabled while site is down
# You'll usually want to exclude /assets if you'd like to retain CSS.
# It also works for allowing access to admin while the rest is in maintenance mode.
config.middleware.use 'Rack::Maintenance',
  :file => Rails.root.join('public', 'maintenance.html'),
  :without => /\A\/assets/

Note on Patches/Pull Requests¶ ↑

  • Fork the project.

  • Make your feature addition or bug fix in a branch.

  • Add tests for it.

  • Commit, do not mess with Rakefile or VERSION (do that in a separate commit if you want a local version)

  • Push your branch.

  • Send me a pull request.

Space Babies¶ ↑

We create internet. www.spacebabies.nl

License¶ ↑

BSD. See LICENSE for details.