blog/functions/images/[[catchall]].js

11 lines
344 B
JavaScript
Raw Normal View History

export async function onRequestGet (context) {
const { pathname } = new URL(context.request.url)
const imageURL = new URL(pathname, 'https://mdleom.com')
2024-10-06 21:18:56 +00:00
const headers = new Headers(context.request.headers)
headers.set('Host', 'mdleom.com')
const imageRequest = new Request(imageURL, {
2024-10-06 20:52:38 +00:00
headers
})
return fetch(imageRequest)
2024-10-06 20:06:16 +00:00
}