LOG IN SIGN UP
Documentation

Failover configuration

This guide describes how to configure a failover origin server. A failover (backup) server ensures you can maintain availability of your content if your primary server is not available.

Before you begin

Before you configure failover, keep in mind the following:

Configuring a failover origin server

Once you've confirmed health checks are configured, you must:

  1. Turn off automatic load balancing on both the primary origin server and the server that will become your failover.
  2. Create headers that configure both the primary and failover origin servers.
  3. Create a header condition that specifies exactly when to use the failover server.

Turn off automatic load balancing

To configure a failover origin server you must turn off automatic load balancing for both the server that will act as your primary origin server and the server that will become your failover origin server.

  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.
  5. Click the name of the origin server you want to configure. The Edit a host page appears.

    selecting no in the auto-load balancing menu of the Edit Backend window

  6. From the Auto load balance menu, select No.

  7. Click the Update button to apply the changes.

Configure the primary and failover origin servers

Once you've turned off automatic load balancing, create two new request headers, one each for your primary and failover servers.

  1. Click the Content tab. The Content page appears.
  2. Click the Create header button to create the first request header. The Create a new header window appears.

    setting up a request header to set the primary origin server

  3. Fill out the Create a new header fields as follows:

    • From the Type menu, select Request, and from the Action menu, select Set.
    • In the Destination field, type the name of the header that will be affected by the selected action.
    • In the Source field, type where the new content for the header comes from.
    • Leave the Ignore if set and Priority controls at their default settings.
    • In the Description field, type a descriptive name for the header. This name is displayed in the Fastly web interface.
  4. Click the Create button to create the first header. A new header appears on the Content page.

  5. Click the Create header button to create a second request header. The Create a new header window appears.

    setting up a request header to set the default backend failover

  6. Fill out the Create a new header fields as follows:

    • From the Type menu, select Request, and from the Action menu, select Set.
    • In the Destination field, type the name of the header that will be affected by the selected action.
    • In the Source field, type where the new content for the header comes from.
    • Leave the Ignore if set control at the default setting.
    • In the Priority field, type a number at least one higher than the priority you set on the primary server's request header. For example, if you left the first header's priority set to the default, 10, you would set the second header's priority to 11 or higher.
    • In the Description field, type a descriptive name for the header. This name is displayed in the Fastly web interface.
  7. Click the Create button to create the second header. A new header appears on the Content page.

Specify when to use the failover server

Once you've configured your primary and failover servers, create an associated header condition that specifies exactly when the failover server should be used.

  1. On the Content page, click the Attach a condition link next to the new header you just created for the failover origin server. The Create a new request condition window appears.

    setting a request condition for unhealthy backends

  2. Fill out the Create a new request condition fields as follows:

    • From the Type menu, select Request.
    • In the Name field, type a descriptive name for the new condition (for example, Primary Down).
    • In the Apply if field, type the appropriate request condition that will be applied. For example, req.restarts > 0 || !req.backend.healthy would tell the system only to use the failover server if the number of restarts is more than 0 or the origin is unhealthy.
    • In the Priority field, type 11.
  3. Click the Save and apply to button to create the new condition for the header.

  4. Click the Activate button to deploy your configuration changes.


Back to Top