From 64a29d95a011ce589d17f567b18e93d0e8202408 Mon Sep 17 00:00:00 2001 From: Ming Di Leom <2809763-curben@users.noreply.gitlab.com> Date: Sun, 6 Oct 2024 20:45:26 +0000 Subject: [PATCH] fix(cf-pages): rewrite host worker host is restricted to mdleom.com --- functions/images/[[catchall]].js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/functions/images/[[catchall]].js b/functions/images/[[catchall]].js index befddee..b79269c 100644 --- a/functions/images/[[catchall]].js +++ b/functions/images/[[catchall]].js @@ -1,12 +1,12 @@ -export async function onRequestGet(context) { - // const {pathname} = new URL(context.request.url) - // const imageURL = new URL(pathname, 'https://mdleom.com') - // const imageRequest = new Request(imageURL, { - // headers: context.request.headers - // }) +export async function onRequestGet (context) { + const { pathname } = new URL(context.request.url) + const imageURL = new URL(pathname, 'https://mdleom.com') + const imageRequest = new Request(imageURL, { + headers: context.request.headers + }) // return fetch(imageRequest) // CF_IMAGES binds to cf-images worker // configured in the pages dashboard - return context.env.CF_IMAGES.fetch(context.request) + return context.env.CF_IMAGES.fetch(imageRequest) }