You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation/docs/backend/Backend/Backend.mdx
+2-65Lines changed: 2 additions & 65 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,18 +10,9 @@ import {Fiddle} from '@site/src/components/fiddle';
10
10
11
11
The **`Backend` constructor** lets you dynamically create new [Fastly Backends](https://developer.fastly.com/reference/api/services/backend/) for your Fastly Compute service.
12
12
13
-
Dynamically creating new [Fastly Backends](https://developer.fastly.com/reference/api/services/backend/) is disabled by default for Fastly Services. Please contact [Fastly Support](https://support.fastly.com/hc/requests/new?ticket_form_id=360000269711) to request the feature be enabled on the Fastly Services which require Dynamic Backends.
13
+
>**Note**: Dynamic backends are by default disabled at the Fastly service level. Contact [Fastly Support](https://support.fastly.com/hc/en-us/requests/new?ticket_form_id=360000269711) to request dynamic backends on Fastly Services.
14
14
15
-
By default, Dynamic Backends are disabled within a JavaScript application as it can be a potential avenue for third-party JavaScript code to send requests, potentially including sensitive/secret data, off to destinations that the JavaScript project was not intending, which could be a security issue.
16
-
17
-
To enable Dynamic Backends the application will need to explicitly allow Dynamic Backends via:
**Note**: Backend constructors can only be used when processing requests, not during build-time initialization.
15
+
To disable the usage of dynamic backends, see [enforceExplicitBackends](../enforceExplicitBackends.mdx).
25
16
26
17
## Syntax
27
18
@@ -122,58 +113,8 @@ A new `Backend` object.
122
113
123
114
## Examples
124
115
125
-
In this example an implicit Dynamic Backend is created when making the fetch request to <https://www.fastly.com/>andtheresponseisthenreturnedtotheclient.
This method is deprecated, and dynamic backends are now always supported when enabled at the service level. See [`enforceExplicitBackends`](./enforceExplicitBackends.mdx) instead.
14
+
15
+
:::
16
+
17
+
The **`allowDynamicBackends()`** function is used to control whether or not Dynamic Backends should be allowed within this Fastly Compute Service.
18
+
19
+
By default, Dynamic Backends are enabled, but can be a potential security concern since third-party JavaScript code may send arbitrary requests, potentially including sensitive/secret data, off to destinations that the JavaScript project was not intending.
20
+
21
+
Using `allowDynamicBackends(false)` this security property can be restored to only use explicit backend definitions.
22
+
23
+
>**Note**: By default, while dynamic backends are allowed in the SDK, they are by default disabled at the Fastly service level.
Call this function to enforce the security property of explicitly-defined backends, even when dynamic backends are enabled at
11
+
the Fastly service level.
12
+
13
+
By default, if dynamic backends are supported for the Fastly service, they will be automatically used when creating a new
14
+
`fetch()` request. This default behaviour for dynamic backends can be a potential security concern since third-party JavaScript
15
+
code may send arbitrary requests, including sensitive/secret data, off to destinations that the JavaScript project was not
16
+
intending.
17
+
18
+
When calling this function, an optional default backend name can be provided.
19
+
20
+
>**Note**: This is a separate option to the service-level dynamic backend support for Fastly services, which is by deault disabled for Fastly services.
21
+
22
+
The **`enforceExplicitBackends()`** function is used to control whether or not Dynamic Backends should be allowed within this Fastly Compute Service.
23
+
24
+
By default, Dynamic Backends are enabled, but can be a potential security concern since third-party JavaScript code may send arbitrary requests, potentially including sensitive/secret data, off to destinations that the JavaScript project was not intending.
25
+
26
+
Using `allowDynamicBackends(false)` this security property can be restored to only use explicit backend definitions.
27
+
28
+
>**Note**: Dynamic Backends are disabled by default for Fastly Services. Please contact [Fastly Support](https://support.fastly.com/hc/requests/new?ticket_form_id=360000269711) to request the feature be enabled or disabled on Fastly Services.
29
+
30
+
## Syntax
31
+
32
+
```js
33
+
enforceExplicitBackends(defaultBackend?)
34
+
```
35
+
36
+
### Parameters
37
+
38
+
- `defaultBackend` _: string_ _**optional**_
39
+
- An optional default backend string name to use in `fetch()` requests.
Copy file name to clipboardExpand all lines: documentation/docs/globals/fetch.mdx
+20Lines changed: 20 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,26 @@ not_ reject on HTTP errors (`404`, etc.). Instead, a
23
23
> **Note:** The `fetch()` method's parameters are identical to
24
24
> those of the `Request()` constructor.
25
25
26
+
## Explicit Backends
27
+
28
+
Internally, Fastly uses named backends to handle fetch requests, which need to be explicitly defined to enable custom HTTP origins to be fetched by the service.
29
+
30
+
This `backend` option is then a special Fastly-specific fetch option that is provided to the `fetch()` call:
Backends are configured using the Fastly service backend configuration, see the [Backend documentation](https://developer.fastly.com/reference/api/services/backend/) for more information.
37
+
38
+
## Dynamic Backends
39
+
40
+
Dynamic backends are a compute feature that allow services to define backends for themselves. This is a service-level Fastly feature that must be enabled through [Fastly Support](https://support.fastly.com/hc/en-us/requests/new?ticket_form_id=360000269711).
41
+
42
+
When dynamic backends are enabled at the service level, the explicit `backend` option is no longer required for `fetch()` requests, and will instead be automatically created.
43
+
44
+
In addition, custom backend confiuration options can then also be provided through the [`Backend()`](../fastly:backend/Backend/Backend.mdx) constructor.
0 commit comments