fix(cf-pages): rewrite host

worker host is restricted to mdleom.com
This commit is contained in:
Ming Di Leom 2024-10-06 20:45:26 +00:00
parent 3fc28281b2
commit 64a29d95a0
No known key found for this signature in database
GPG Key ID: 32D3E28E96A695E8
1 changed files with 7 additions and 7 deletions

View File

@ -1,12 +1,12 @@
export async function onRequestGet (context) { export async function onRequestGet (context) {
// const {pathname} = new URL(context.request.url) const { pathname } = new URL(context.request.url)
// const imageURL = new URL(pathname, 'https://mdleom.com') const imageURL = new URL(pathname, 'https://mdleom.com')
// const imageRequest = new Request(imageURL, { const imageRequest = new Request(imageURL, {
// headers: context.request.headers headers: context.request.headers
// }) })
// return fetch(imageRequest) // return fetch(imageRequest)
// CF_IMAGES binds to cf-images worker // CF_IMAGES binds to cf-images worker
// configured in the pages dashboard // configured in the pages dashboard
return context.env.CF_IMAGES.fetch(context.request) return context.env.CF_IMAGES.fetch(imageRequest)
} }