From 913dc2b93ddf28b45238f3feb674b670056aaf5c Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 4 May 2026 02:50:59 +0000 Subject: [PATCH] fix: derive QR target URL from request, not stale env var PUBLIC_BASE_URL was pointing to the planned pages.dev domain that was never wired up, so QR codes encoded a non-functional URL. Use the request's own origin as the source of truth (which also handles custom domains automatically when added later) and only fall back to PUBLIC_BASE_URL when an explicit override is passed via ?url=. Also update PUBLIC_BASE_URL to the actual workers.dev hostname so nothing else points at the wrong place. https://claude.ai/code/session_01TPBqgcSJMppgrpiq7fLywL --- apps/api/src/routes/public.ts | 5 +---- apps/web/wrangler.toml | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/apps/api/src/routes/public.ts b/apps/api/src/routes/public.ts index 72404ae..0e11648 100644 --- a/apps/api/src/routes/public.ts +++ b/apps/api/src/routes/public.ts @@ -77,10 +77,7 @@ publicRoutes.get('/qrcode', async (c) => { const overrideUrl = c.req.query('url'); const reqUrl = new URL(c.req.url); - const base = - overrideUrl ?? - c.env.PUBLIC_BASE_URL ?? - `${reqUrl.protocol}//${reqUrl.host}`; + const base = overrideUrl ?? `${reqUrl.protocol}//${reqUrl.host}`; const target = base.replace(/\/$/, '') + '/enviar'; if (format === 'svg') { diff --git a/apps/web/wrangler.toml b/apps/web/wrangler.toml index f9e884b..fd58929 100644 --- a/apps/web/wrangler.toml +++ b/apps/web/wrangler.toml @@ -21,7 +21,7 @@ bucket_name = "wedding-media" [vars] COUPLE_NAMES = "Stefanie & Leandro" -PUBLIC_BASE_URL = "https://stefanieeleandro.pages.dev" +PUBLIC_BASE_URL = "https://stefanieeleandro.lronetto.workers.dev" S3_REGION = "auto" S3_BUCKET = "wedding-media" S3_FORCE_PATH_STYLE = "true"