resolve_backend
resolve_backend(url: str, fastly_backend: str | None = None, timeout_config: TimeoutConfig | None = None) -> BackendResolutionResolve backend name and final URL for a request.
This function determines which Fastly backend to use for a request:
- If
fastly_backendis 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
- RequestException — If backend resolution fails
- MissingSchema — If URL is missing scheme (subclass of RequestException)