LOG IN SIGN UP
Documentation

Health checks tutorial

In this tutorial we show you how to create health checks that periodically contacts your origin servers to make sure they're still working.

We assume that you're already accustomed to editing and deploying configurations using the web interface. If you're not familiar with basic editing using the web interface, see our Help Guides to learn more before you continue.

Overview

Health checks, while simple in principle, are more involved than most other configuration objects. Let's run through the options you have when creating a health check so you have a place to start when working through the tutorial.

Fastly will periodically check your origin server based on the options chosen. Pay special attention to the HTTP host header. A common mistake is setting the wrong host. If the origin server does not receive a host it expects, it may issue a 301 or 302 redirect causing the health check to fail. Also, Varnish requires the origin server receiving the health check requests to close the connection for each request. If the origin server does not close the connection, health checks will time out and fail.

If an origin server is marked unhealthy due to health checks, Fastly will stop attempting to send requests to it. If all origin servers are marked unhealthy, Fastly will attempt to serve stale. If no stale object is available, a 503 will be returned to the client.

Creating a health check

  1. Log in to the Fastly web interface and click the Configure link.
  2. From the service menu, select the appropriate service.
  3. Click the Edit configuration button and then select Clone active. The service version page appears.
  4. Click the Origins tab. The Origins page appears.

    the Origins page

  5. Click the Create health check button. The Create a new health check page appears.

    Create a new health check

  6. Fill out the Create a new health check fields. For more information, review the field descriptions in the Overview section.

  7. Click the Create button. Your new health check now appears in the list of checks.

Assigning a health check

Health checks do nothing on their own, but they can be added as a special parameter to an origin server in your configuration.

  1. Edit one of your existing origin servers by clicking the origin server's name. The Edit a host page appears.
  2. From the Health checks menu, select the health check you just created.

    Editing an origin server via the Edit window

  3. Click Update.

Fastly will now use the health check to monitor the selected origin server.


Back to Top