resolve_backend

Functionin backendfastly-compute 0.1.3View source
resolve_backend(url: str, fastly_backend: str | None = None, timeout_config: TimeoutConfig | None = None) -> BackendResolution

Resolve backend name and final URL for a request.

This function determines which Fastly backend to use for a request:

  • If fastly_backend is provided, attempts to open that pre-configured static backend
  • Otherwise, registers/reuses a dynamic backend based on the URL's netloc

Static backends must already be configured in the Fastly service. Dynamic backends are automatically registered on first use and cached for reuse.

Parameters

url: str

The URL to request (must be full with scheme and netloc for dynamic backends)

fastly_backend: str | Noneoptional = None

Optional static backend name

timeout_config: TimeoutConfig | Noneoptional = None

Optional timeout configuration for dynamic backends

Returns

BackendResolution

ResolutionResult containing backend and updated parsed url

Throws