fix(site): serve the landing domain from the Pages deployment
Some checks failed
deploy-site / deploy (push) Failing after 1m26s
Some checks failed
deploy-site / deploy (push) Failing after 1m26s
d3ro.chanpaca.net answered an empty Cloudflare 404 because the account had no
Pages project for the landing site, and attaching the custom domain still needs
a DNS CNAME that the local Cloudflare credentials cannot create. Add a small
Workers route bridge that serves the Pages deployment on that hostname so the
domain works now and keeps following Pages deploys, and record the cleanup
left to do.
💘 Generated with Crush
Assisted-by: Crush:deepseek-v4.1-flash
This commit is contained in:
parent
79ecdc89c4
commit
0ca9e242fa
4 changed files with 52 additions and 3 deletions
29
server/cloudflare-site-bridge/src/index.ts
Normal file
29
server/cloudflare-site-bridge/src/index.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
// server/cloudflare-site-bridge/src/index.ts
|
||||
// d3ro.chanpaca.net → Cloudflare Pages(d3ro.pages.dev) 프록시.
|
||||
//
|
||||
// Pages 커스텀 도메인은 존 DNS에 CNAME을 요구하므로, DNS를 건드릴 수 없는 동안
|
||||
// 이 워커가 도메인을 살린다. 콘텐츠 정본은 Pages 배포본 하나이므로 CI가 Pages에
|
||||
// 배포하면 도메인에도 그대로 반영된다.
|
||||
|
||||
const PAGES_ORIGIN = 'https://d3ro.pages.dev'
|
||||
|
||||
export default {
|
||||
async fetch(request: Request): Promise<Response> {
|
||||
const target = new URL(request.url)
|
||||
target.protocol = 'https:'
|
||||
target.hostname = new URL(PAGES_ORIGIN).hostname
|
||||
target.port = ''
|
||||
|
||||
const headers = new Headers(request.headers)
|
||||
headers.delete('host')
|
||||
|
||||
const hasBody = request.method !== 'GET' && request.method !== 'HEAD'
|
||||
|
||||
return fetch(target.toString(), {
|
||||
method: request.method,
|
||||
headers,
|
||||
body: hasBody ? request.body : undefined,
|
||||
redirect: 'manual',
|
||||
})
|
||||
},
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue