mirror of https://gitlab.com/curben/blog
fix(cf-pages): rewrite host
worker host is restricted to mdleom.com
This commit is contained in:
parent
3fc28281b2
commit
64a29d95a0
|
@ -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
|
||||
// })
|
||||
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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue