From 0ca9e242fa4cada94ce34326ce237b8a7f4b24f5 Mon Sep 17 00:00:00 2001 From: Yun Chan Date: Sat, 19 Sep 2026 09:21:19 +0900 Subject: [PATCH] fix(site): serve the landing domain from the Pages deployment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- docs/map/02-infrastructure.md | 4 +-- docs/map/11-gap-backlog.md | 2 +- server/cloudflare-site-bridge/src/index.ts | 29 +++++++++++++++++++++ server/cloudflare-site-bridge/wrangler.toml | 20 ++++++++++++++ 4 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 server/cloudflare-site-bridge/src/index.ts create mode 100644 server/cloudflare-site-bridge/wrangler.toml diff --git a/docs/map/02-infrastructure.md b/docs/map/02-infrastructure.md index 5dd86a5..836a6db 100644 --- a/docs/map/02-infrastructure.md +++ b/docs/map/02-infrastructure.md @@ -142,7 +142,7 @@ Stages `validate โ†’ test โ†’ build โ†’ e2e โ†’ package โ†’ publish โ†’ deploy`. ### Forgejo Actions (`.forgejo/workflows/`) `portable.yml` โ€” ํƒœ๊ทธ/์ˆ˜๋™ ์‹คํ–‰์œผ๋กœ **์„œ๋ช… ์—†์ด** portable ์ฑ„๋„(95MiB 7z ๋ถ„ํ•  ๋ณผ๋ฅจ + Scoop ๋งค๋‹ˆํŽ˜์ŠคํŠธ + ์„ค์น˜ ์Šคํฌ๋ฆฝํŠธ)์„ ๊ฒŒ์‹œํ•œ๋‹ค. `WIN_CSC_*` ๋ถˆํ•„์š”, updater feed๋Š” ๊ฑด๋“œ๋ฆฌ์ง€ ์•Š๋Š”๋‹ค. -`deploy-site.yml` / `deploy-site-windows.yml` โ€” build `site`, write release identity, deploy to Cloudflare Pages `d3ro` (`d3ro.chanpaca.net`), verify live commit/version, app-links, legal URLs. +`deploy-site.yml` / `deploy-site-windows.yml` โ€” build `site`, write release identity, deploy to Cloudflare Pages `d3ro` (`d3ro.pages.dev`), verify live commit/version, app-links, legal URLs. ์ปค์Šคํ…€ ๋„๋ฉ”์ธ `d3ro.chanpaca.net` ์€ Pages ์ปค์Šคํ…€ ๋„๋ฉ”์ธ์ด DNS CNAME์„ ์š”๊ตฌํ•˜๋ฏ€๋กœ, DNS๋ฅผ ๊ฑด๋“œ๋ฆด ์ˆ˜ ์—†๋Š” ๋™์•ˆ์€ Workers ๋ผ์šฐํŠธ ๋ธŒ๋ฆฌ์ง€ `server/cloudflare-site-bridge/`(`d3ro.chanpaca.net/*` โ†’ Pages ํ”„๋ก์‹œ, ์ˆ˜๋™ `npx wrangler deploy`)๊ฐ€ ์„œ๋น™ํ•œ๋‹ค. CNAME์„ ์ถ”๊ฐ€ํ•œ ๋’ค ๋ธŒ๋ฆฌ์ง€๋ฅผ ์‚ญ์ œํ•˜๋ฉด Pages ์ปค์Šคํ…€ ๋„๋ฉ”์ธ์œผ๋กœ ์ง์ ‘ ์„œ๋น™๋œ๋‹ค(GAP-REL-09b). `release.yml` โ€” tag-triggered Windows build (signed) + `publish-forgejo-release.mjs` to the canonical Forgejo feed/release hub. --- @@ -159,7 +159,7 @@ Stages `validate โ†’ test โ†’ build โ†’ e2e โ†’ package โ†’ publish โ†’ deploy`. Deploy scripts: `scripts/deploy-nas.ps1`, `scripts/deploy-nas.sh`, `scripts/deploy-site-to-nas.js`, `scripts/nas-control.sh` (start/stop/restart/status/logs/backup/update). -Public endpoints (production): `https://d3ro.chanpaca.net` (portal/API), `https://admin.chanpaca.net` (admin CRM). Edge: `server/cloudflare-worker` proxying to the NAS origin, plus a **Cron Trigger** (`* * * * *`) that drains the Supabase push outbox via `send-push?mode=drain` (`src/push-drain.ts`; needs `SUPABASE_URL` var + `SUPABASE_SERVICE_ROLE_KEY` secret). Tunnel: Cloudflare Tunnel `kd-nas`. +Public endpoints (production): `https://d3ro.chanpaca.net` โ€” **๋žœ๋”ฉ/๋‹ค์šด๋กœ๋“œ ์„ผํ„ฐ**(2026-09-19๋ถ€ํ„ฐ Pages `d3ro` ๋ฐฐํฌ๋ณธ์„ Workers ๋ผ์šฐํŠธ ๋ธŒ๋ฆฌ์ง€๊ฐ€ ์„œ๋น™; ๊ทธ ์ด์ „์—๋Š” ๋ฐ”์ธ๋”ฉ์ด ์—†์–ด ๋นˆ 404์˜€๋‹ค), `https://admin.chanpaca.net` (admin CRM). Edge: `server/cloudflare-worker` proxying to the NAS origin, plus a **Cron Trigger** (`* * * * *`) that drains the Supabase push outbox via `send-push?mode=drain` (`src/push-drain.ts`; needs `SUPABASE_URL` var + `SUPABASE_SERVICE_ROLE_KEY` secret). Tunnel: Cloudflare Tunnel `kd-nas` (NAS ํฌํ„ธ/API๋Š” ํ˜„์žฌ ์ด ํ˜ธ์ŠคํŠธ๋„ค์ž„์— ๋ฐ”์ธ๋”ฉ๋˜์–ด ์žˆ์ง€ ์•Š๋‹ค). --- diff --git a/docs/map/11-gap-backlog.md b/docs/map/11-gap-backlog.md index 99ca3d9..984365d 100644 --- a/docs/map/11-gap-backlog.md +++ b/docs/map/11-gap-backlog.md @@ -24,7 +24,7 @@ Legend: `[ ]` open ยท `[~]` in progress ยท `[!]` blocked externally ยท `[x]` res | GAP-REL-01 | Release | Official release publication to Forgejo and active public download center deployment. | `scripts/ci/publish-forgejo-release.mjs`, `apps/web/src/app/download/page.tsx`, `site/src/sections/Download.tsx`, `apps/web/e2e/red_team_cycle4_web.spec.ts` | `[~]` 2026-09-15: v1.1.0 release assets (`D3RO-Voice-Setup-1.1.0-x64.exe`, `.blockmap`, `latest.yml`, `update-policy.json`) published to canonical Forgejo registry and release hub. 2026-09-16: the published 1.1.0 installer carries no Authenticode signature, so it does not satisfy the release policy; product version moved to `1.2.0` and publication must come from CI with the signing gate GREEN. Download centers in `apps/web` (`/download`) and `site` (`#download`) link the canonical Forgejo feed. 2026-09-19: `1.3.7` (overlay fix) is published to the canonical updater feed (`latest.yml` = 1.3.7, 90.6MiB); the CI signing gate that blocks tag-driven publication is still unresolved, so this went out through the local updater path (GAP-REL-06). | | GAP-REL-08 | Release | ๋‹ค์šด๋กœ๋“œ ์„ผํ„ฐ๊ฐ€ **์กด์žฌํ•˜์ง€ ์•Š๋Š” ์„ค์น˜ ํŒŒ์ผ**์„ ๊ฐ€๋ฆฌ์ผฐ๋‹ค. `apps/web/src/lib/desktop-release.ts`์™€ `site/src/release.ts`์˜ `DESKTOP_VERSION`์ด `1.2.0`์— ๋ฉˆ์ถฐ ์žˆ์–ด ์„ค์น˜ URL์ด `D3RO-Voice-Setup-1.2.0-x64.exe`์˜€๊ณ , ๊ทธ ๊ฒฝ๋กœ๋Š” ํ”ผ๋“œ์—์„œ 404๋‹ค(์‹ค์ธก: 1.2.0=404, 1.3.7=206). `version:sync`๊ฐ€ ์ด ๋‘ ํ‘œ๋ฉด์„ ๋ฎ์ง€ ์•Š์•„ ๊ณ„์† ์–ด๊ธ‹๋‚ฌ๋‹ค. | `scripts/ci/sync-version.mjs`, `apps/web/src/lib/desktop-release.ts`, `site/src/release.ts` | `[x]` 2026-09-19: ๋‘ ๋‹ค์šด๋กœ๋“œ ๊ณ„์•ฝ ํŒŒ์ผ์„ `sync-version.mjs` ๋Œ€์ƒ์— ์ถ”๊ฐ€ํ•ด ๋ฒ„์ „ยท๋ฆด๋ฆฌ์Šค์ผ์ด SSOT์—์„œ ์ž๋™ ๋ฐ˜์˜๋˜๋„๋ก ํ•˜๊ณ , ํ˜„์žฌ ๊ฐ’(1.3.7 / 2026-09-19)์œผ๋กœ ์ •์ •ํ–ˆ๋‹ค. `version:check`ยทtypecheckยทsite ๋นŒ๋“œ GREEN. | | GAP-REL-09 | Release | ๋žœ๋”ฉ ์‚ฌ์ดํŠธ๊ฐ€ **์žฌ๋ฐฐํฌ๋˜์ง€ ์•Š๋Š”๋‹ค**. `deploy` ์›Œํฌํ”Œ๋กœ๊ฐ€ main push๋งˆ๋‹ค ์‹คํŒจํ•œ๋‹ค. ์‹ค์ธก ์›์ธ(run#66 ๋กœ๊ทธ): `site/src/sections/Hero.tsx`๊ฐ€ ํƒ€์ด๋จธ ref๋ฅผ `NodeJS.Timeout`์œผ๋กœ ํƒ€์ดํ•‘ํ•ด `@types/node` ๋„ค์ž„์ŠคํŽ˜์ด์Šค๊ฐ€ ํ•„์š”ํ–ˆ๊ณ , ๋ฐฐํฌ ์žก์€ `npm ci --prefix site`๋งŒ ํ•˜๋ฏ€๋กœ ์กฐ์ƒ `node_modules`์˜ hoisted ํƒ€์ž…์ด ์—†์–ด `tsc -b`๊ฐ€ `TS2503: Cannot find namespace 'NodeJS'`๋กœ ์‹คํŒจํ•œ๋‹ค. ๊ทธ๋ž˜์„œ `https://d3ro.chanpaca.net/release-identity.json`์ด 404๋‹ค(๊ณต๊ฐœ ๋ฒ„์ „ ๊ฒ€์ฆ ๋ถˆ๊ฐ€). | `.forgejo/workflows/deploy-site.yml`, `site/src/sections/Hero.tsx` | `[x]` 2026-09-19: ref๋ฅผ `ReturnType`์œผ๋กœ ๋ฐ”๊ฟ” hoisted ํƒ€์ž… ์˜์กด์„ ์ œ๊ฑฐํ–ˆ๋‹ค(๊ฒฉ๋ฆฌ `--typeRoots`๋กœ CI ์กฐ๊ฑด ์žฌํ˜„ โ†’ ์ˆ˜์ • ์ „ TS2503, ์ˆ˜์ • ํ›„ clean). ๊ฐ™์€ ์ˆ˜์ •์„ pushํ•˜์ž `deploy` run#67์ด ์‚ฌ์ดํŠธ ๋นŒ๋“œ๋ฅผ ํ†ต๊ณผํ•ด `dist/`๋ฅผ ๋งŒ๋“ค์—ˆ๊ณ , ์‹คํŒจ๋Š” ๋‹ค์Œ ๋‹จ๊ณ„(Cloudflare)๋กœ ์ด๋™ํ–ˆ๋‹ค. | -| GAP-REL-09b | Release | `d3ro.chanpaca.net`์ด 404์˜€๋˜ ์ง์ ‘ ์›์ธ: ์ด Cloudflare ๊ณ„์ •์— Pages ํ”„๋กœ์ ํŠธ `d3ro`/`d3ro-voice`๊ฐ€ **์กด์žฌํ•˜์ง€ ์•Š์•„** ์ปค์Šคํ…€ ๋„๋ฉ”์ธ ๋ฐ”์ธ๋”ฉ์ด ์—†์—ˆ๋‹ค(๋นˆ ๋ณธ๋ฌธ 404, `cf-ray`๋งŒ ๋ฐ˜ํ™˜). `deploy-site.yml`์€ `CF_API_TOKEN` ์‹œํฌ๋ฆฟ์ด ์—†์–ด ๋งˆ์ง€๋ง‰ ๊ฒŒ์‹œ ๋‹จ๊ณ„์—์„œ๋„ `exit 1`์ด๋‹ค. | `.forgejo/workflows/deploy-site.yml`, `docs/map/02-infrastructure.md` | `[~]` 2026-09-19: Pages ํ”„๋กœ์ ํŠธ `d3ro` ์ƒ์„ฑ โ†’ `site/dist` ๋ฐฐํฌ(`environment=production`, branch `main`, `d3ro.pages.dev` 200, `release-identity.json` = {commit `2407f5a`, version `1.3.7`}) โ†’ ์ปค์Šคํ…€ ๋„๋ฉ”์ธ `d3ro.chanpaca.net` ์—ฐ๊ฒฐ. **๋‚จ์€ ๊ฒƒ**: ๋„๋ฉ”์ธ ์ƒํƒœ `pending` + `CNAME record not set` โ€” ๋กœ์ปฌ wrangler OAuth ํ† ํฐ์— DNS ์Šค์ฝ”ํ”„๊ฐ€ ์—†์–ด(403 Authentication error) ๋ ˆ์ฝ”๋“œ ์ƒ์„ฑ ๋ถˆ๊ฐ€. ๋Œ€์‹œ๋ณด๋“œ์—์„œ `CNAME d3ro โ†’ d3ro.pages.dev`(Proxied, ๊ธฐ์กด `d3ro` ๋ ˆ์ฝ”๋“œ ์ œ๊ฑฐ) ์ถ”๊ฐ€ ํ•„์š”. CI ์ž๋™ ๋ฐฐํฌ๊นŒ์ง€ ๊ฐ€๋ ค๋ฉด `CF_API_TOKEN`(Pages:Edit) + `CF_ACCOUNT_ID`=`8e83cc130e7329c160cf2b88d6b4c20a`๋ฅผ Forgejo ์‹œํฌ๋ฆฟ์— ๋“ฑ๋กํ•œ๋‹ค. | +| GAP-REL-09b | Release | `d3ro.chanpaca.net`์ด 404์˜€๋˜ ์ง์ ‘ ์›์ธ: ์ด Cloudflare ๊ณ„์ •์— Pages ํ”„๋กœ์ ํŠธ `d3ro`/`d3ro-voice`๊ฐ€ **์กด์žฌํ•˜์ง€ ์•Š์•„** ์ปค์Šคํ…€ ๋„๋ฉ”์ธ ๋ฐ”์ธ๋”ฉ์ด ์—†์—ˆ๋‹ค(๋นˆ ๋ณธ๋ฌธ 404, `cf-ray`๋งŒ ๋ฐ˜ํ™˜). Pages ์ปค์Šคํ…€ ๋„๋ฉ”์ธ์€ ์กด DNS CNAME(`d3ro โ†’ d3ro.pages.dev`)์„ ์š”๊ตฌํ•˜๋Š”๋ฐ ๊ธฐ์กด `d3ro` ๋ ˆ์ฝ”๋“œ๊ฐ€ ๋‚จ์•„ ์žˆ์–ด `CNAME record not set`์œผ๋กœ pending์— ๋จธ๋ฌผ๋ €๊ณ , ๋กœ์ปฌ wrangler ์ž๊ฒฉ์ฆ๋ช…์—๋Š” DNS ์Šค์ฝ”ํ”„๊ฐ€ ์—†๋‹ค(403 Authentication error). `deploy-site.yml`์€ `CF_API_TOKEN` ์‹œํฌ๋ฆฟ์ด ์—†์–ด ๋งˆ์ง€๋ง‰ ๊ฒŒ์‹œ ๋‹จ๊ณ„์—์„œ๋„ `exit 1`์ด๋‹ค. | `server/cloudflare-site-bridge/`, `.forgejo/workflows/deploy-site.yml`, `docs/map/02-infrastructure.md` | `[x]` 2026-09-19: Pages ํ”„๋กœ์ ํŠธ `d3ro` ์ƒ์„ฑ + `site/dist` production ๋ฐฐํฌ(`d3ro.pages.dev` 200, `release-identity.json` = commit `2407f5a` / 1.3.7) + ์ปค์Šคํ…€ ๋„๋ฉ”์ธ ์—ฐ๊ฒฐ. DNS ์—†์ด ๋„๋ฉ”์ธ์„ ์‚ด๋ฆฌ๊ธฐ ์œ„ํ•ด Workers ๋ผ์šฐํŠธ ๋ธŒ๋ฆฌ์ง€(`server/cloudflare-site-bridge`, `d3ro.chanpaca.net/*` โ†’ Pages ํ”„๋ก์‹œ, `npx wrangler deploy`)๋ฅผ ๋ฐฐํฌ โ†’ ๋ผ์ด๋ธŒ ํ™•์ธ: `/`ยท`/privacy/`ยท`/terms/`ยท`/delete-account/` 200, ๋ผ์ด๋ธŒ ๋ฒˆ๋“ค์ด ์„ค์น˜ ํŒŒ์ผ๋ช…์„ `1.3.7`๋กœ ๊ณ„์‚ฐ, `/download.html` โ†’ `/#download`. ๋‚จ์€ ์ •๋ฆฌ 2๊ฑด: (1) ๋Œ€์‹œ๋ณด๋“œ์— CNAME์„ ์ถ”๊ฐ€ํ•œ ๋’ค ๋ธŒ๋ฆฌ์ง€ ์›Œ์ปค ์‚ญ์ œ, (2) CI ์ž๋™ ๊ฒŒ์‹œ๋ฅผ ์œ„ํ•ด `CF_API_TOKEN`(Pages/Workers Edit) + `CF_ACCOUNT_ID`=`8e83cc130e7329c160cf2b88d6b4c20a`๋ฅผ Forgejo ์‹œํฌ๋ฆฟ์— ๋“ฑ๋ก. | | GAP-REL-10 | Release | `release-windows`(ํƒœ๊ทธ ํŒŒ์ดํ”„๋ผ์ธ)๋Š” ์„œ๋ช… ๊ฐ€๋“œ์— ๋„๋‹ฌํ•˜๊ธฐ **์ „์—** sidecar ๋‹จ๊ณ„์—์„œ ์ฃฝ๋Š”๋‹ค. ์ด ๋Ÿฌ๋„ˆ ์ปจํ…์ŠคํŠธ์—์„œ๋Š” `sidecar:setup`์ด Python 3.11+๋ฅผ ์ฐพ์ง€ ๋ชปํ•œ๋‹ค(`Python 3.11+ ๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค`) โ†’ `sidecar:build` โ†’ `verify-sidecar-bundle.mjs` ์—ฐ์‡„ ์‹คํŒจ(์‹ค์ธก: run#65 `v1.3.7`, run#61 `v1.3.6`). ๊ฐ™์€ ๋Ÿฌ๋„ˆ์˜ portable ์žก์€ `py -3.11 โ†’ Python 3.11.9`๋ฅผ ์ฐพ์•„ ์‚ฌ์ด๋“œ์นด ๋นŒ๋“œ์— ์„ฑ๊ณตํ•˜๋ฏ€๋กœ, ์›Œํฌํ”Œ๋กœ/์ปจํ…Œ์ด๋„ˆ ๊ฐ„ PATH ์ฐจ์ด๋‹ค. | `.forgejo/workflows/release.yml`, `apps/desktop/scripts/setup-sidecar.mjs` | `[!]` 2026-09-19: ๋Ÿฌ๋„ˆ์— Python 3.11+(`py` ๋Ÿฐ์ฒ˜ ํฌํ•จ)๋ฅผ ๋ณด์žฅํ•˜๊ฑฐ๋‚˜ ์›Œํฌํ”Œ๋กœ์— `actions/setup-python` ๋‹จ๊ณ„๋ฅผ ์ถ”๊ฐ€ํ•œ๋‹ค. ๊ทธ ์ „๊นŒ์ง€ ์„œ๋ช… ๊ฒŒ์‹œ๋Š” ๋ถˆ๊ฐ€๋Šฅํ•˜๋‹ค(GAP-REL-02์™€ ๋ณ„๊ฐœ ์„ ํ–‰ ์ฐจ๋‹จ). | | GAP-REL-11 | Release | portable ์›Œํฌํ”Œ๋กœ์˜ ๋งˆ์ง€๋ง‰ `actions/upload-artifact@v4` ๋‹จ๊ณ„๊ฐ€ Forgejo ๋Ÿฌ๋„ˆ์—์„œ `GHESNotSupportedError`๋กœ ์‹คํŒจํ•œ๋‹ค(์ฆ๊ฑฐ ๋ณด์กด๋งŒ ์‹คํŒจ, ๊ฒŒ์‹œ๋Š” ์„ฑ๊ณต). | `.forgejo/workflows/portable.yml` | `[x]` 2026-09-19: `v1.3.7` portable ๊ฒŒ์‹œ๋Š” run#64์—์„œ ์„ฑ๊ณต(7z ๋‹จ์ผ ๋ณผ๋ฅจ 83.7MB + zip 2๋ถ€, `portable-latest/portable.json`์ด 1.3.7 ๋ณด๊ณ ). ๋‚จ์€ ์กฐ์น˜: upload-artifact ๋‹จ๊ณ„๋ฅผ ์ œ๊ฑฐํ•˜๊ฑฐ๋‚˜ v3/๋‹ค๋ฅธ ๋ณด์กด ๋ฐฉ์‹์œผ๋กœ ๋ฐ”๊ฟ” ์›Œํฌํ”Œ๋กœ๋ฅผ GREEN์œผ๋กœ ๋งŒ๋“ ๋‹ค. | | GAP-REL-02 | Release | Windows stable publication needs an external public-trust Authenticode PFX, its password, the exact signer subject, and a Forgejo token, none of which live in the repository. | `.forgejo/workflows/release.yml`, `.gitlab-ci.yml`, `scripts/ci/set-forgejo-secrets.mjs`, `scripts/ci/verify-windows-release-artifact.ps1` | `[!]` 2026-09-18 measured: the Forgejo repo had **zero** Actions secrets; `FORGEJO_TOKEN` is registered now (2026-09-18) but `WIN_CSC_*` still have no values, so `v1.2.0` (run 49) and `v1.3.0` (run 51) both failed at the signing guard and **no updater-feed release has been published since `1.1.0`**. Inject the four secrets (`WIN_CSC_LINK`, `WIN_CSC_KEY_PASSWORD`, `WIN_CSC_EXPECTED_SIGNER_SUBJECT`, `FORGEJO_TOKEN`) with `npm run release:secrets` (check: `npm run release:secrets:check`), then re-run `release.yml` for the `v1.3.0` tag via `workflow_dispatch` (tags are immutable). **2026-09-19 ์ •์ •**: CI ์„œ๋ช… ๊ฒŒ์ดํŠธ๋Š” ์—ฌ์ „ํžˆ ๋ง‰ํ˜€ ์žˆ์ง€๋งŒ, updater feed์—๋Š” `1.3.2`~`1.3.7`์ด ๋กœ์ปฌ `release:updater` ๊ฒฝ๋กœ๋กœ ๊ฒŒ์‹œ๋˜์–ด ์žˆ๋‹ค(GAP-REL-06). | diff --git a/server/cloudflare-site-bridge/src/index.ts b/server/cloudflare-site-bridge/src/index.ts new file mode 100644 index 0000000..a1b34e8 --- /dev/null +++ b/server/cloudflare-site-bridge/src/index.ts @@ -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 { + 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', + }) + }, +} diff --git a/server/cloudflare-site-bridge/wrangler.toml b/server/cloudflare-site-bridge/wrangler.toml new file mode 100644 index 0000000..9b9df39 --- /dev/null +++ b/server/cloudflare-site-bridge/wrangler.toml @@ -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" } +]