The following results in a NetworkError/HTTP Protocol Error for me:
import { Backend } from "fastly:backend";
addEventListener("fetch", (event: FetchEvent) =>
event.respondWith(handleRequest(event)),
);
async function handleRequest(event: FetchEvent): Promise<Response> {
const backend = new Backend({
name: "fastly",
target: "www.fastly.com:443",
});
try {
const res = await fetch("https://www.fastly.com", {
backend,
});
return new Response("ok");
} catch (e) {
console.log("GOT ERR:", e.code, e.name, e.message);
return new Response("nope");
}
}
The following results in a
NetworkError/HTTP Protocol Errorfor me: