How to Generate a Custom Heroku Maintenance Mode Page

2 min read Kane Jamison Kane Jamison

I recently had to put our Content Harmony Heroku app into maintenance mode, and discovered it is possible to set a custom URL as your Maintenance Mode experience if users visit while the site is down.

This is a pretty straightforward feature, but delivers a nicer branded experience when you need to put a Heroku app into maintenance mode. We recently did this on Content Harmony both for Postgres upgrades, as well as while migrating our database to a new provider.

The default Heroku Maintenance Mode page experience looks more like a site outage than scheduled downtime.

If you read the docs, you can set any URL as the page that is shown during maintenance mode, rather than this Heroku branded page.

So, we created a dedicated page on our marketing site (which runs on Ghost, not Rails and Heroku, so isn't affected by maintenance mode).

The page lives at /maintenance-mode, and we also added <meta name="robots" content="noindex"> to make it clear that the page should not be indexed by Google, etc.

Our custom branded Maintenance Mode page confirms that the App is shut down on purpose and will be running again shortly.

From there, you just list that URL as a Config Var for MAINTENANCE_PAGE_URL in your Heroku settings for your app:

ENV VAR settings for Heroku Maintenance Mode

The page will now appear any time you run or toggle the Maintenance Mode in your App's settings: