diff --git a/builder/src/build/build-worker/templates/worker.ts b/builder/src/build/build-worker/templates/worker.ts index da4e400..84541b9 100644 --- a/builder/src/build/build-worker/templates/worker.ts +++ b/builder/src/build/build-worker/templates/worker.ts @@ -36,12 +36,13 @@ export default { const url = new URL(request.url); if (url.pathname === "/_next/image") { - // TODO: not implemented - return fetch( + let imageUrl = url.searchParams.get("url") ?? - "https://developers.cloudflare.com/_astro/logo.BU9hiExz.svg", - { cf: { cacheEverything: true } } as any - ); + "https://developers.cloudflare.com/_astro/logo.BU9hiExz.svg"; + if (imageUrl.startsWith("/")) { + imageUrl = new URL(imageUrl, request.url).href; + } + return fetch(imageUrl, { cf: { cacheEverything: true } } as any); } const resBody = new TransformStream();