fastly.try_select_shield

BACKENDfastly.try_select_shieldBACKENDshieldBACKENDfallback

Available inall subroutines.

Function to selectively return a shield director if all of the following are true:

  • The director points to a valid Fastly shield and is healthy
  • It has not previously been visited in this request

Otherwise, the fallback director is returned.

This enables the specified shield site to be selected as a backend only once during a request's lifecycle, without the need to inspect headers or use a Fastly POP by its IATA identifier.

Example

sub vcl_miss {
set req.backend = fastly.try_select_shield(ssl_shield_iad_va_us, req.backend);
}