mirror of https://gitlab.com/curben/blog
fix(cf-pages): rewrite host header
This commit is contained in:
parent
64a29d95a0
commit
ab2bca0b64
|
@ -1,8 +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 headers = new Headers({
|
||||||
|
...context.request.headers,
|
||||||
|
'Host': 'mdleom.com'
|
||||||
|
})
|
||||||
const imageRequest = new Request(imageURL, {
|
const imageRequest = new Request(imageURL, {
|
||||||
headers: context.request.headers
|
headers
|
||||||
})
|
})
|
||||||
// return fetch(imageRequest)
|
// return fetch(imageRequest)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue