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
* The name has to be between 1 and 254 characters inclusive.
6
+
* The name can be whatever you would like, as long as it does not match the name of any of the static service backends nor match any other dynamic backends built during a single execution of the application.
7
+
*
8
+
* @throws {TypeError} Throws a TypeError if the value is not valid. I.E. The value is null, undefined, an empty string or a string with more than 254 characters.
5
9
*/
6
10
name: string;
7
11
/**
8
12
* A hostname, IPv4, or IPv6 address for the backend as well as an optional port.
9
-
* E.G. "hostname", "ip address", "hostname:port", or "ip address:port"
13
+
* If set, the target has to be at-least 1 character.
14
+
*
15
+
* @example hostname
16
+
* "example.com"
17
+
* @example hostname and port
18
+
* "example.com:443"
19
+
* @example ip address
20
+
* "1.2.3.4"
21
+
* @example ip address and port
22
+
* "1.2.3.4:8080"
23
+
*
24
+
* @throws {TypeError} Throws a TypeError if the value is not valid. I.E. Is null, undefined, an empty string, not a valid IP address or host, or is the string `::`
10
25
*/
11
26
target: string;
12
27
/**
13
28
* If set, will force the HTTP Host header on connections to this backend to be the supplied value.
29
+
*
30
+
* @example
31
+
* "example.com:443"
32
+
*
33
+
* @throws {TypeError} Throws a TypeError if the value is an empty string.
14
34
*/
15
35
hostOverride?: string;
16
36
/**
17
37
* Maximum duration in milliseconds to wait for a connection to this backend to be established.
18
38
* If exceeded, the connection is aborted and a 503 response will be presented instead.
19
-
* Defaults to 1,000 milliseconds.
39
+
* @defaultValue 1_000
40
+
* @throws {RangeError} Throws a RangeError if the value is negative or greater than or equal to 2^32
20
41
*/
21
42
connectTimeout?: number;
22
43
/**
23
44
* Maximum duration in milliseconds to wait for the server response to begin after a TCP connection is established and the request has been sent.
24
45
* If exceeded, the connection is aborted and a 503 response will be presented instead.
25
-
* Defaults to 15,000 milliseconds.
46
+
* @defaultValue 15_000
47
+
* @throws {RangeError} Throws a RangeError if the value is negative or greater than or equal to 2^32
26
48
*/
27
49
firstByteTimeout?: number;
28
50
/**
29
51
* Maximum duration in milliseconds that Fastly will wait while receiving no data on a download from a backend.
30
52
* If exceeded, the response received so far will be considered complete and the fetch will end.
31
-
* Defaults to 10,000 milliseconds.
53
+
* @defaultValue 10_000
54
+
* @throws {RangeError} Throws a RangeError if the value is negative or greater than or equal to 2^32
* Minimum allowed TLS version on SSL connections to this backend.
40
63
* If the backend server is not able to negotiate a connection meeting this constraint, a 503 response will be presented instead.
64
+
*
65
+
* @throws {RangeError} Throws a RangeError if the value is not 1, 1.1, 1.2, or 1.3
41
66
*/
42
-
tlsMinVersion?: number;
67
+
tlsMinVersion?: 1|1.1|1.2|1.3;
43
68
/**
44
69
* Maximum allowed TLS version on SSL connections to this backend.
45
70
* If the backend server is not able to negotiate a connection meeting this constraint, a 503 response will be presented instead.
71
+
*
72
+
* @throws {RangeError} Throws a RangeError if the value is not 1, 1.1, 1.2, or 1.3
46
73
*/
47
-
tlsMaxVersion?: number;
74
+
tlsMaxVersion?: 1|1.1|1.2|1.3;
48
75
/**
49
76
* Define the hostname that the server certificate should declare.
77
+
*
78
+
* @throws {TypeError} Throws a TypeError if the value is an empty string.
50
79
*/
51
80
certificateHostname?: string;
52
-
/**
53
-
* Whether or not to validate the server certificate.
54
-
* Highly recommended to enable this if `useSSL` is set to `true`.
55
-
*/
56
-
checkCertificate?: boolean;
57
81
/**
58
82
* The CA certificate to use when checking the validity of the backend.
83
+
*
84
+
* @throws {TypeError} Throws a TypeError if the value is an empty string.
59
85
*/
60
86
caCertificate?: string;
61
87
/**
62
88
* List of OpenSSL ciphers to support for connections to this origin.
63
89
* If the backend server is not able to negotiate a connection meeting this constraint, a 503 response will be presented instead.
90
+
*
91
+
* [List of ciphers supported by Fastly](https://developer.fastly.com/learning/concepts/routing-traffic-to-fastly/#use-a-tls-configuration).
92
+
*
93
+
* @throws {TypeError} Throws a TypeError if the value is an empty string.
64
94
*/
65
95
ciphers?: string;
66
96
/**
67
97
* The SNI hostname to use on connections to this backend.
98
+
*
99
+
* @throws {TypeError} Throws a TypeError if the value is an empty string.
68
100
*/
69
101
sniHostname?: string;
70
102
}
71
103
72
104
/**
73
-
* Class for creating new [Fastly Backends](https://developer.fastly.com/reference/api/services/backend/).
105
+
* Class for dynamically creating new [Fastly Backends](https://developer.fastly.com/reference/api/services/backend/).
106
+
*
107
+
* @note
108
+
* This feature is in disabled by default for Fastly Services. Please contact [Fastly Support](https://support.fastly.com/hc/en-us/requests/new?ticket_form_id=360000269711) to request the feature be enabled on the Fastly Services which require Dynamic Backends.
74
109
*
110
+
* By default, Dynamic Backends are disabled within a JavaScript application as it can be a potential
111
+
* avenue for third-party JavaScript code to send requests, potentially including sensitive/secret data,
112
+
* off to destinations that the JavaScript project was not intending, which could be a security issue.
113
+
*
114
+
* To enable Dynamic Backends the application will need to explicitly allow Dynamic Backends via:
115
+
* ```js
116
+
* import { allowDynamicBackends } from "fastly:experimental";
117
+
* allowDynamicBackends(true);
118
+
* ```
119
+
*
75
120
* **Note**: Can only be used when processing requests, not during build-time initialization.
121
+
*
122
+
* @example
123
+
* In this example an implicit Dynamic Backend is created when making the fetch request to https://www.fastly.com/ and the response is then returned to the client.
124
+
*
125
+
* View this example on [Fiddle](https://fiddle.fastly.dev/fiddle/e5b6fa0e).
126
+
*
127
+
* ```js
128
+
* /// <reference types="@fastly/js-compute" />
129
+
* import { allowDynamicBackends } from "fastly:experimental";
130
+
* allowDynamicBackends(true);
131
+
* async function app() {
132
+
* // For any request, return the fastly homepage -- without defining a backend!
0 commit comments