Examples
Fetch url
Proxy a request to another URL with fetch, keeping the original path.
This script appends the incoming request path to another domain and fetches the
content from there.
Last modified on August 17, 2026
Was this page helpful?
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Proxy a request to another URL with fetch, keeping the original path.
import * as BunnySDK from "@bunny.net/edgescript-sdk";
BunnySDK.net.http.serve(
async (request: Request): Response | Promise<Response> => {
const url = new URL(request.url);
const fetchUrl = "https://example.com";
return fetch(fetchUrl + url.pathname);
},
);
Was this page helpful?