- Heroku Cookbook
- Mike Coutermarsh
- 247字
- 2021-08-05 17:14:28
Enabling the maintenance page
Occasionally, we will need to make changes to our application that requires downtime. The proper way to do this is to put up a maintenance page that displays a friendly message and respond to all the incoming HTTP requests with a 503 Service Unavailable
status.
Doing this will keep our users informed and also avoid any negative SEO effects. Search engines understand that when they receive a 503 response, they should come back later to recrawl the site. If we didn't use a maintenance page and our application returned a 404 or 500 error instead, it's possible that a search engine crawler might remove the page from their index.
How to do it...
Let's open up a terminal and navigate to one of our Heroku projects to begin with, using the following steps:
- We can view if our application's maintenance page is currently enabled with the
maintenance
command:$ heroku maintenance off
- Let's try turning it on. This will stop traffic from being routed to our dynos and show the maintenance page as follows:
$ heroku maintenance:on Enabling maintenance mode for load-tester-rails... done
- Now, if we visit our application, we'll see the default Heroku maintenance page:
- To disable the maintenance page and resume sending users to our application, we can use the
maintenance:off
command:$ heroku maintenance:off Disabling maintenance mode for lo ad-tester-rails... done
See also
- To learn how to customize the maintenance page, take a look at Chapter 4, Production-ready with Heroku
推薦閱讀
- Spring 5.0 Microservices(Second Edition)
- ThinkPHP 5實戰(zhàn)
- Microsoft Dynamics 365 Extensions Cookbook
- Twilio Best Practices
- HTML5+CSS3基礎開發(fā)教程(第2版)
- 編譯系統(tǒng)透視:圖解編譯原理
- 精通Python自然語言處理
- Python漫游數(shù)學王國:高等數(shù)學、線性代數(shù)、數(shù)理統(tǒng)計及運籌學
- Jupyter數(shù)據科學實戰(zhàn)
- Learning Raspbian
- C專家編程
- C#程序設計(項目教學版)
- Android嵌入式系統(tǒng)程序開發(fā):基于Cortex-A8(第2版)
- Natural Language Processing with Python Quick Start Guide
- Scala編程實戰(zhàn)