From ab2bca0b64899f1997cffa807823bc6d8e7fdbc9 Mon Sep 17 00:00:00 2001 From: Ming Di Leom <2809763-curben@users.noreply.gitlab.com> Date: Sun, 6 Oct 2024 20:52:38 +0000 Subject: [PATCH] fix(cf-pages): rewrite host header --- functions/images/[[catchall]].js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/functions/images/[[catchall]].js b/functions/images/[[catchall]].js index b79269c..7069269 100644 --- a/functions/images/[[catchall]].js +++ b/functions/images/[[catchall]].js @@ -1,8 +1,12 @@ export async function onRequestGet (context) { const { pathname } = new URL(context.request.url) const imageURL = new URL(pathname, 'https://mdleom.com') + const headers = new Headers({ + ...context.request.headers, + 'Host': 'mdleom.com' + }) const imageRequest = new Request(imageURL, { - headers: context.request.headers + headers }) // return fetch(imageRequest)