From 69479291c9e7ad8ff5cfa102d1bbff5b169a21ea Mon Sep 17 00:00:00 2001 From: Ashwin Kumar Sivakumar Date: Mon, 27 Jul 2026 20:53:26 +0530 Subject: [PATCH] Fix captcha not rendering on admin login: route through /api/gateway proxy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /api/auth/captcha has no server route in this SolidStart app (only /api/admin/* and /api/gateway/* are proxied to the backend), so the request was silently falling through to the SPA's index.html (200, text/html) instead of hitting the real endpoint — captchaChallenge stayed empty and the canvas rendered blank. Use the existing generic /api/gateway/* proxy instead, which already resolves auth/* paths correctly. Co-Authored-By: Claude Sonnet 5 --- src/routes/login.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/routes/login.tsx b/src/routes/login.tsx index 116924c..5662f74 100644 --- a/src/routes/login.tsx +++ b/src/routes/login.tsx @@ -40,10 +40,13 @@ export default function LoginPage() { // The employees service (which backs /api/admin/auth/login) requires the // same server-side captcha challenge the public site uses — generated by // the users service at /api/auth/captcha and verified against shared Redis. + // Routed through /api/gateway/* (this app's generic gateway proxy) rather + // than a bare /api/auth/* path — there is no server route for that prefix, + // so it would otherwise silently fall through to the SPA's index.html. const loadCaptcha = async () => { setCaptchaInput(''); try { - const r = await fetch('/api/auth/captcha', { method: 'POST', headers: { Accept: 'application/json' }, credentials: 'include' }); + const r = await fetch('/api/gateway/auth/captcha', { method: 'POST', headers: { Accept: 'application/json' }, credentials: 'include' }); const payload = await r.json().catch(() => ({})); setCaptchaId(String(payload?.captcha_id || '')); setCaptchaChallenge(String(payload?.challenge || ''));