mirror of https://gitlab.com/curben/blog
feat: cloudflare pages function
This commit is contained in:
parent
78d5348e41
commit
5fbbd85b12
|
@ -40,6 +40,7 @@ skip_render:
|
||||||
include:
|
include:
|
||||||
- "_headers" # Netlify header rule
|
- "_headers" # Netlify header rule
|
||||||
- "_redirects" # Netlify redirects rule
|
- "_redirects" # Netlify redirects rule
|
||||||
|
- "_routes.json" # Cloudflare Pages function
|
||||||
|
|
||||||
# Writing
|
# Writing
|
||||||
new_post_name: :title.md # File name of new posts
|
new_post_name: :title.md # File name of new posts
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
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
|
||||||
|
// })
|
||||||
|
// return fetch(imageRequest)
|
||||||
|
return context.env.CF_IMAGES.fetch(context.request)
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"include": ["/images/*"],
|
||||||
|
"exclude": []
|
||||||
|
}
|
|
@ -4,4 +4,10 @@ compatibility_date = "2024-09-23"
|
||||||
compatibility_flags = [ "nodejs_compat" ]
|
compatibility_flags = [ "nodejs_compat" ]
|
||||||
send_metrics = false
|
send_metrics = false
|
||||||
|
|
||||||
|
# worker
|
||||||
route = { pattern = "https://mdleom.com/images/*", zone_name = "mdleom.com" }
|
route = { pattern = "https://mdleom.com/images/*", zone_name = "mdleom.com" }
|
||||||
|
|
||||||
|
# pages function
|
||||||
|
[[services]]
|
||||||
|
binding = "CF_IMAGES"
|
||||||
|
service = "cf-images"
|
||||||
|
|
Loading…
Reference in New Issue