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
This commit is contained in:
parent
516def235a
commit
913dc2b93d
@ -77,10 +77,7 @@ publicRoutes.get('/qrcode', async (c) => {
|
|||||||
const overrideUrl = c.req.query('url');
|
const overrideUrl = c.req.query('url');
|
||||||
|
|
||||||
const reqUrl = new URL(c.req.url);
|
const reqUrl = new URL(c.req.url);
|
||||||
const base =
|
const base = overrideUrl ?? `${reqUrl.protocol}//${reqUrl.host}`;
|
||||||
overrideUrl ??
|
|
||||||
c.env.PUBLIC_BASE_URL ??
|
|
||||||
`${reqUrl.protocol}//${reqUrl.host}`;
|
|
||||||
const target = base.replace(/\/$/, '') + '/enviar';
|
const target = base.replace(/\/$/, '') + '/enviar';
|
||||||
|
|
||||||
if (format === 'svg') {
|
if (format === 'svg') {
|
||||||
|
|||||||
@ -21,7 +21,7 @@ bucket_name = "wedding-media"
|
|||||||
|
|
||||||
[vars]
|
[vars]
|
||||||
COUPLE_NAMES = "Stefanie & Leandro"
|
COUPLE_NAMES = "Stefanie & Leandro"
|
||||||
PUBLIC_BASE_URL = "https://stefanieeleandro.pages.dev"
|
PUBLIC_BASE_URL = "https://stefanieeleandro.lronetto.workers.dev"
|
||||||
S3_REGION = "auto"
|
S3_REGION = "auto"
|
||||||
S3_BUCKET = "wedding-media"
|
S3_BUCKET = "wedding-media"
|
||||||
S3_FORCE_PATH_STYLE = "true"
|
S3_FORCE_PATH_STYLE = "true"
|
||||||
|
|||||||
Reference in New Issue
Block a user