From 617f2f3b22dbc7905cbd059ae8a6c9b0d9660583 Mon Sep 17 00:00:00 2001 From: Carl Assmann Date: Fri, 27 Nov 2026 16:22:08 +0100 Subject: [PATCH] Prepare Tilly production routes on Cloudflare written with gpt-6.1-sol in Codex (T3 Code) --- README.md | 18 +++++++++++++----- src/server/cloudflare.ts | 4 ++++ wrangler.production.jsonc | 19 +++++++++++++++++++ 3 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 wrangler.production.jsonc diff --git a/README.md b/README.md index 37a9647..056faac 100644 --- a/README.md +++ b/README.md @@ -113,12 +113,20 @@ production environment. Do not commit environment files. The scheduled handler invokes the existing authenticated notification route. Staging deliberately has no cron trigger: Vercel still runs the hourly job. -Before production cutover, attach the domain, connect automatic builds and -verify sign-in/chat. Disable the Vercel cron, then enable `0 * * * *` in the -production Worker's triggers. Keep Vercel available for rollback. Never enable -both schedulers together. +Production uses `wrangler.production.jsonc` on the same Worker after staging +verification. It attaches only the apex and `www` routes. The apex redirects to +`www` with HTTP 307, preserving paths and queries. Keep the wildcard and Clerk +DNS records unchanged. -written with GPT-6 in Codex (T3 Code) +GitHub `main` builds automatically in Cloudflare. Set the deploy command to +`bunx wrangler deploy --config wrangler.production.jsonc` after verifying sign-in +and chat. The default command continues to deploy staging until then. + +Disable the Vercel cron before adding `0 * * * *` to the production Wrangler +configuration. Keep Vercel available for rollback. Never enable both schedulers +together. + +written with gpt-6.1-sol in Codex (T3 Code) ## License diff --git a/src/server/cloudflare.ts b/src/server/cloudflare.ts index 525506a..fcdb685 100644 --- a/src/server/cloudflare.ts +++ b/src/server/cloudflare.ts @@ -13,6 +13,10 @@ function createExports(manifest: SSRManifest) { let astro = createAstroExports(manifest).default let fetch: WorkerFetch = async (request, environment, context) => { let url = new URL(request.url) + if (url.hostname === "tilly.social") { + url.hostname = "www.tilly.social" + return Response.redirect(url, 307) + } if (url.pathname === "/app" || url.pathname.startsWith("/app/")) { url.pathname = "/app/" return environment.ASSETS.fetch(url.href) diff --git a/wrangler.production.jsonc b/wrangler.production.jsonc new file mode 100644 index 0000000..17dbadb --- /dev/null +++ b/wrangler.production.jsonc @@ -0,0 +1,19 @@ +{ + "$schema": "node_modules/wrangler/config-schema.json", + "name": "tilly-migration", + "account_id": "568edba45e81a5b744aecae456748db4", + "main": "dist/_worker.js/index.js", + "compatibility_date": "2026-11-25", + "compatibility_flags": ["nodejs_compat"], + "workers_dev": true, + "preview_urls": false, + "routes": [ + { "pattern": "tilly.social/*", "zone_name": "tilly.social" }, + { "pattern": "www.tilly.social/*", "zone_name": "tilly.social" }, + ], + "assets": { + "directory": "./dist", + "binding": "ASSETS", + "run_worker_first": true, + }, +}