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',
|
||||
})
|
||||
},
|
||||
}
|
||||
20
server/cloudflare-site-bridge/wrangler.toml
Normal file
20
server/cloudflare-site-bridge/wrangler.toml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# server/cloudflare-site-bridge/wrangler.toml
|
||||
#
|
||||
# d3ro.chanpaca.net 을 Cloudflare Pages 배포본(d3ro.pages.dev)에 연결하는 브리지.
|
||||
#
|
||||
# 왜 필요한가: Pages 커스텀 도메인은 존 DNS에 CNAME(d3ro → d3ro.pages.dev)을 요구한다.
|
||||
# 기존 d3ro 레코드가 남아 있어 Pages가 레코드를 만들지 못하고("CNAME record not set")
|
||||
# 도메인은 빈 404를 반환했다. DNS 편집 권한 없이 도메인을 살리기 위해, 이미 프록시된
|
||||
# 호스트네임에 Workers 라우트를 걸어 Pages 배포본을 그대로 서빙한다.
|
||||
#
|
||||
# 정리(권장): 대시보드에서 CNAME d3ro → d3ro.pages.dev 를 추가한 뒤 이 라우트와
|
||||
# 워커를 제거하면 트래픽이 Pages 커스텀 도메인으로 직접 흐른다.
|
||||
# npx wrangler delete --name d3ro-site-bridge (라우트는 워커 삭제 시 함께 해제)
|
||||
|
||||
name = "d3ro-site-bridge"
|
||||
main = "src/index.ts"
|
||||
compatibility_date = "2024-04-01"
|
||||
|
||||
routes = [
|
||||
{ pattern = "d3ro.chanpaca.net/*", zone_name = "chanpaca.net" }
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue