官术网_书友最值得收藏!

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:

  1. We can view if our application's maintenance page is currently enabled with the maintenance command:
    $ heroku maintenance
     off
    
  2. 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
    
  3. Now, if we visit our application, we'll see the default Heroku maintenance page:
  4. 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
主站蜘蛛池模板: 平原县| 灵丘县| 永仁县| 江达县| 中江县| 来安县| 遂昌县| 永善县| 灵川县| 上林县| 青冈县| 琼海市| 清镇市| 湖州市| 来凤县| 西乌珠穆沁旗| 大同县| 寻甸| 双辽市| 屏东市| 江都市| 加查县| 余江县| 芮城县| 彭阳县| 保靖县| 宁津县| 白朗县| 榆林市| 新余市| 玉田县| 兴宁市| 雅江县| 女性| 梧州市| 铁力市| 永川市| 西林县| 梧州市| 西吉县| 宁阳县|