###############################################
# This fiddle's purpose is to show the proper #
# way to perform a restart and failover to a  #
# secondary backend, given the request hash   #
# is unchanged between the two requests       #  
###############################################

# Set default backend
set req.backend = F_origin_0;

# Prevent client from messing with the request flow
if (req.restarts == 0) {
  unset req.http.restarts;
  unset req.http.try-alt-origin;
  # Restart failover handling
} elsif (req.http.try-alt-origin) {
  set req.http.restarts = req.restarts; # Use restart value for vary key
  set req.http.Fastly-Force-Shield = "1"; # Re-enable clustering
  set req.backend = F_origin_1; # Set failover backend
}