Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Install wasi-sdk-20 (linux)"
- name: "Install wasi-sdk-30 (linux)"
run: |
set -x
curl -sS -L -O https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz
tar xf wasi-sdk-20.0-linux.tar.gz
curl -sS -L -O https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-30/wasi-sdk-30.0-x86_64-linux.tar.gz
tar xf wasi-sdk-30.0-x86_64-linux.tar.gz
sudo mkdir -p /opt/wasi-sdk
sudo mv wasi-sdk-20.0/* /opt/wasi-sdk/
sudo mv wasi-sdk-30.0-x86_64-linux/* /opt/wasi-sdk/
ls /opt/wasi-sdk/
- run: |
/opt/wasi-sdk/bin/clang-format --version
Expand Down Expand Up @@ -171,10 +171,10 @@ jobs:
with:
node-version: 'lts/*'
- run: npm ci
- name: Install Rust 1.81.0
- name: Install Rust 1.88.0
run: |
rustup toolchain install 1.81.0
rustup target add wasm32-wasip1 --toolchain 1.81.0
rustup toolchain install 1.88.0
rustup target add wasm32-wasip1 --toolchain 1.88.0
- name: Restore wasm-tools from cache
uses: actions/cache@v3
id: wasm-tools
Expand Down Expand Up @@ -207,10 +207,10 @@ jobs:
with:
node-version: 'lts/*'
- run: npm ci
- name: Install Rust 1.81.0
- name: Install Rust 1.88.0
run: |
rustup toolchain install 1.81.0
rustup target add wasm32-wasip1 --toolchain 1.81.0
rustup toolchain install 1.88.0
rustup target add wasm32-wasip1 --toolchain 1.88.0
- name: Restore wasm-tools from cache
uses: actions/cache@v3
id: wasm-tools
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ jobs:
with:
node-version: 'lts/*'
- run: npm ci
- name: Install Rust 1.81.0
- name: Install Rust 1.88.0
run: |
rustup toolchain install 1.81.0
rustup target add wasm32-wasip1 --toolchain 1.81.0
rustup toolchain install 1.88.0
rustup target add wasm32-wasip1 --toolchain 1.88.0
- name: Restore wasm-tools from cache
uses: actions/cache@v3
id: wasm-tools
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@ wpt-runtime.wasm
docs-app/bin/main.wasm
docs-app/pkg/*.tar.gz

# Local wasmtime install
/packages/wasmtime/bin

yarn-error.log
.vscode
.vscode
16 changes: 8 additions & 8 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ To build from source, you need to have the following tools installed to successf
```sh
cargo install cbindgen
```
- [wasi-sdk, version 20](https://github.com/WebAssembly/wasi-sdk/releases/tag/wasi-sdk-20),
- [wasi-sdk, version 30](https://github.com/WebAssembly/wasi-sdk/releases/tag/wasi-sdk-30),
with alternate [install instructions](https://github.com/WebAssembly/wasi-sdk#install)
```sh
curl -sS -L -O https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz
tar xf wasi-sdk-20.0-linux.tar.gz
curl -sS -L -O https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-30/wasi-sdk-30.0-x86_64-linux.tar.gz
tar xf wasi-sdk-30.0-x86_64-linux.tar.gz
sudo mkdir -p /opt/wasi-sdk
sudo mv wasi-sdk-20.0/* /opt/wasi-sdk/
sudo mv wasi-sdk-30.0-x86_64-linux/* /opt/wasi-sdk/
```

Build the runtime using npm:
Expand Down Expand Up @@ -101,13 +101,13 @@ npm run build
cargo install --locked wasm-tools
```

- [wasi-sdk, version 20](https://github.com/WebAssembly/wasi-sdk/releases/tag/wasi-sdk-20),
- [wasi-sdk, version 30](https://github.com/WebAssembly/wasi-sdk/releases/tag/wasi-sdk-30),
with alternate [install instructions](https://github.com/WebAssembly/wasi-sdk#install)
```sh
curl -sS -L -O https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-macos.tar.gz
tar xf wasi-sdk-20.0-macos.tar.gz
curl -sS -L -O https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-30/wasi-sdk-30.0-arm64-macos.tar.gz
tar xf wasi-sdk-30.0-arm64-macos.tar.gz
sudo mkdir -p /opt/wasi-sdk
sudo mv wasi-sdk-20.0/* /opt/wasi-sdk/
sudo mv wasi-sdk-30.0-arm64-macos/* /opt/wasi-sdk/
```

Build the runtime using npm:
Expand Down
39 changes: 0 additions & 39 deletions documentation/app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 20 additions & 8 deletions documentation/docs/backend/Backend/Backend.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ pagination_prev: null

The **`Backend` constructor** lets you dynamically create new [Fastly Backends](https://developer.fastly.com/reference/api/services/backend/) for your Fastly Compute service.

>**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.
> **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.

To disable the usage of dynamic backends, see [enforceExplicitBackends](../enforceExplicitBackends.mdx).

## Syntax

```js
new Backend(backendConfiguration)
new Backend(backendConfiguration);
```

> **Note:** `Backend()` can only be constructed with `new`. Attempting to call it without `new` throws a [`TypeError`](../../globals/TypeError/TypeError.mdx).
Expand Down Expand Up @@ -86,7 +86,7 @@ new Backend(backendConfiguration)
- `certificate` _: string_
- The PEM certificate string.
- `key` _: SecretStoreEntry_
- The `SecretStoreEntry` to use for the key, created via [`SecretStore.prototype.get`](../../fastly:secret-store/SecretStore/prototype/get.mdx) or alteratively via [`SecretStore.fromBytes`](../../fastly:secret-store/SecretStore/fromBytes.mdx).
- The `SecretStoreEntry` to use for the key, created via [`SecretStore.prototype.get`](pathname://../../fastly:secret-store/SecretStore/prototype/get.mdx) or alteratively via [`SecretStore.fromBytes`](pathname://../../fastly:secret-store/SecretStore/fromBytes.mdx).
- `httpKeepalive` _: number_ _**optional**_
- Enable HTTP keepalive, setting the timout in milliseconds.
- `tcpKeepalive` _: boolean | object_ _**optional**_
Expand All @@ -99,7 +99,7 @@ new Backend(backendConfiguration)
- Number of probes to send to the backend before it is considered dead.
- `grpc` _: boolean_ _**optional**_
- **_Experimental feature_**
- When enabled, sets that this backend is to be used for gRPC traffic.
- When enabled, sets that this backend is to be used for gRPC traffic.
- _Warning: When using this experimental feature, no guarantees are provided for behaviours for backends that do not provide gRPC traffic._

All optional generic options can have their defaults set via [`setDefaultDynamicBackendConfig()`](../setDefaultDynamicBackendConfig.mdx).
Expand All @@ -110,6 +110,18 @@ This includes all configuration options above except for `name`, `target`, `host

A new `Backend` object.

### Disable TLS verification

TLS certificate verification for a backend can be disabled by leaving the following fields **unset** in your `backendConfiguration`:

- `sniHostname`
- `caCertificate`
- `certificateHostname`

If these fields are not configured, the Compute app does not validate the certificate presented by the backend. As a result, it will accept certificates that are expired, self-signed, issued for a different hostname or otherwise invalid.

However, as a best practice, your origin should serve a valid TLS certificate and your Compute app should verify it to help protect backend connections from man-in-the-middle attacks.

## Examples

In this example an explicit Dynamic Backend is created and supplied to the fetch request, the response is then returned to the client.
Expand Down Expand Up @@ -163,13 +175,13 @@ addEventListener("fetch", event => event.respondWith(app(event)));

```js
/// <reference types="@fastly/js-compute" />
import { Backend } from "fastly:backend";
import { Backend } from 'fastly:backend';
async function app() {
// For any request, return the fastly homepage -- without defining a backend!
const backend = new Backend({
name: 'fastly',
target: 'fastly.com',
hostOverride: "www.fastly.com",
hostOverride: 'www.fastly.com',
connectTimeout: 1000,
firstByteTimeout: 15000,
betweenBytesTimeout: 10000,
Expand All @@ -178,10 +190,10 @@ async function app() {
tlsMaxVersion: 1.3,
});
return fetch('https://www.fastly.com/', {
backend // Here we are configuring this request to use the backend from above.
backend, // Here we are configuring this request to use the backend from above.
});
}
addEventListener("fetch", event => event.respondWith(app(event)));
addEventListener('fetch', (event) => event.respondWith(app(event)));
```

</Fiddle>
17 changes: 8 additions & 9 deletions documentation/docs/backend/setDefaultDynamicBackendConfig.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ The **`setDefaultDynamicBackendConfig()`** allows setting backend configuration
- `certificate` _: string_
- The PEM certificate string.
- `key` _: SecretStoreEntry_
- The `SecretStoreEntry` to use for the key, created via [`SecretStore.prototype.get`](../fastly:secret-store/SecretStore/prototype/get.mdx) or alteratively via [`SecretStore.fromBytes`](../fastly:secret-store/SecretStore/fromBytes.mdx).
- The `SecretStoreEntry` to use for the key, created via [`SecretStore.prototype.get`](pathname://../fastly:secret-store/SecretStore/prototype/get.mdx) or alteratively via [`SecretStore.fromBytes`](pathname://../fastly:secret-store/SecretStore/fromBytes.mdx).
- `httpKeepalive` _: number_ _**optional**_
- Enable HTTP keepalive, setting the timout in milliseconds.
- `tcpKeepalive` _: boolean | object_ _**optional**_
Expand All @@ -73,7 +73,7 @@ The **`setDefaultDynamicBackendConfig()`** allows setting backend configuration
## Syntax

```js
setDefaultDynamicBackendConfig(defaultConfig)
setDefaultDynamicBackendConfig(defaultConfig);
```

### Return value
Expand All @@ -84,7 +84,6 @@ None.

In this example an explicit Dynamic Backend is created and supplied to the fetch request, with timeouts and TLS options provided from the default backend configuration options.


<Fiddle config={{
"type": "javascript",
"title": "Explicit Dynamic Backend Example",
Expand Down Expand Up @@ -139,29 +138,29 @@ addEventListener("fetch", event => event.respondWith(app(event)));

```js
/// <reference types="@fastly/js-compute" />
import { allowDynamicBackends } from "fastly:experimental";
import { Backend } from "fastly:backend";
import { allowDynamicBackends } from 'fastly:experimental';
import { Backend } from 'fastly:backend';
allowDynamicBackends(true);
setDefaultDynamicBackendConfig({
connectTimeout: 1000,
firstByteTimeout: 15_000,
betweenBytesTimeout: 10_000,
useSSL: true,
sslMinVersion: 1.3,
sslMaxVersion: 1.3
sslMaxVersion: 1.3,
});
async function app() {
// For any request, return the fastly homepage -- without defining a backend!
const backend = new Backend({
name: 'fastly',
target: 'fastly.com',
hostOverride: "www.fastly.com"
hostOverride: 'www.fastly.com',
});
return fetch('https://www.fastly.com/', {
backend // Here we are configuring this request to use the backend from above.
backend, // Here we are configuring this request to use the backend from above.
});
}
addEventListener("fetch", event => event.respondWith(app(event)));
addEventListener('fetch', (event) => event.respondWith(app(event)));
```

</Fiddle>
Loading
Loading