fix(cf-pages): service binding in wrangler.toml only applies to worker

This commit is contained in:
Ming Di Leom 2024-10-06 20:21:01 +00:00
parent 5fbbd85b12
commit 3fc28281b2
No known key found for this signature in database
GPG Key ID: 32D3E28E96A695E8
2 changed files with 3 additions and 6 deletions

View File

@ -5,5 +5,8 @@ export async function onRequestGet(context) {
// 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)
}

View File

@ -4,10 +4,4 @@ compatibility_date = "2024-09-23"
compatibility_flags = [ "nodejs_compat" ]
send_metrics = false
# worker
route = { pattern = "https://mdleom.com/images/*", zone_name = "mdleom.com" }
# pages function
[[services]]
binding = "CF_IMAGES"
service = "cf-images"