enforceExplicitBackends

Functionin backend@fastly/js-compute 3.46.0since 3.24.0View source
enforceExplicitBackends(defaultBackend?: string): void

Call this function to enforce the security property of explicitly-defined backends, even when dynamic backends are enabled at the Fastly service level.

By default, if dynamic backends are supported for the Fastly service, they will be automatically used when creating a new fetch() request. This default behaviour for dynamic backends can be a potential security concern since third-party JavaScript code may send arbitrary requests, including sensitive/secret data, off to destinations that the JavaScript project was not intending.

When calling this function, an optional default backend name can be provided.

Parameters

defaultBackend: stringoptional

the name of the default backend to use, when using fetch().

Returns

void