Commit Graph

87 Commits

Author SHA1 Message Date
MarkLo127 ffc36edb97 Fix Railway ECONNREFUSED error by unifying backend URL resolution
Problem: Next.js frontend in production mode falls back to http://backend:8000
(Docker Compose internal hostname) when BACKEND_URL env var is not set.
In Railway's distributed environment, this hostname doesn't exist, causing
ECONNREFUSED errors.

Solution: Create unified getBackendUrl() function with consistent fallback
priority across all server-side proxying files:
1. Explicit BACKEND_URL (for Railway / custom deployment)
2. Development mode -> http://localhost:8000
3. NEXT_PUBLIC_API_URL (may be set in Railway)
4. Docker Compose default -> http://backend:8000

Changes:
- New: frontend/lib/backend-url.ts - centralized URL resolution
- Updated: frontend/next.config.ts - use getBackendUrl()
- Updated: frontend/app/api/chat/route.ts - use getBackendUrl()
- Updated: frontend/app/api/auth/google/token/route.ts - use getBackendUrl()

Railway users must set BACKEND_URL=https://<backend-service>.up.railway.app

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-12 11:03:05 +08:00
MarkLo127 2a8bc6ade8 2026-03-11 20:30:53 +08:00
MarkLo127 62b82788b8 2026-03-11 20:26:37 +08:00
MarkLo127 6802731507 2026-03-11 19:15:24 +08:00
MarkLo127 c305ea5d3b 2026-03-11 18:38:42 +08:00
MarkLo127 a45bd56ad0 2026-03-11 17:46:07 +08:00
MarkLo127 cccf02b8dc 2026-03-11 17:19:43 +08:00
MarkLo127 de09723454 2026-03-11 16:56:32 +08:00
MarkLo127 7103a0ec90 2026-03-11 16:21:51 +08:00
MarkLo127 d405f39d87 2026-03-11 16:09:38 +08:00
MarkLo127 1f5d59ac7a 2026-03-11 15:32:10 +08:00
MarkLo127 e0eab14c11 2026-03-10 18:58:03 +08:00
MarkLo127 071c4bf5cf 2026-03-10 17:58:38 +08:00
MarkLo127 d0c04d4048 2026-03-10 17:36:15 +08:00
MarkLo127 72d287baae 2026-03-10 17:11:02 +08:00
MarkLo127 92c2a84b83 2026-03-10 17:00:32 +08:00
MarkLo127 6e9524c777 2026-03-10 09:13:00 +08:00
MarkLo127 f3cfe21230 2026-03-10 09:05:46 +08:00
MarkLo127 70d763beca 2026-01-27 15:34:37 +08:00
MarkLo127 d58e80a962 2026-01-27 13:22:52 +08:00
MarkLo 6e48ac3f7a 2025-12-24 04:49:04 +08:00
MarkLo 16e513a921 新增英文語系支援 2025-12-24 01:20:33 +08:00
MarkLo 50ef9df44c 2025-12-23 11:12:03 +08:00
MarkLo 40b9a02c42 2025-12-20 09:38:17 +08:00
MarkLo a724f2f447 2025-12-20 09:27:15 +08:00
MarkLo 67830031cc 2025-12-20 09:12:54 +08:00
MarkLo d0d0f7a803 2025-12-18 19:14:09 +08:00
MarkLo 7fabb34e01 2025-12-18 19:00:42 +08:00
MarkLo de28c3e129 2025-12-17 18:54:15 +08:00
MarkLo 908dafc733 2025-12-17 18:15:51 +08:00
MarkLo 53f9202ce8 2025-12-17 18:01:45 +08:00
MarkLo 81d77bea80 2025-12-17 17:48:08 +08:00
MarkLo 99fc89eafe 2025-12-17 06:03:17 +08:00
MarkLo 4bbeaa8e18 2025-12-17 05:41:30 +08:00
MarkLo 79ab46dae8 2025-12-17 05:31:06 +08:00
MarkLo 88cafdd140 2025-12-16 20:34:19 +08:00
MarkLo dfb3979517 2025-12-16 20:24:07 +08:00
MarkLo a028da1903 2025-12-16 20:11:33 +08:00
MarkLo b757e0d2c6 2025-12-16 20:02:27 +08:00
MarkLo e7c3d8acfb 2025-12-16 19:44:35 +08:00
MarkLo 8244ba0eee 2025-12-16 19:30:37 +08:00
MarkLo 803885305a 2025-12-16 19:03:58 +08:00
MarkLo 488eeac64c 2025-12-16 18:45:43 +08:00
MarkLo 5569f1097c 2025-12-16 18:31:24 +08:00
MarkLo 47f04a6ff7 2025-12-16 00:45:07 +08:00
MarkLo b47e79f44a 2025-12-15 03:48:13 +08:00
MarkLo 3568ff5b33 2025-12-15 03:38:56 +08:00
MarkLo facd78aac3 2025-12-15 03:17:48 +08:00
MarkLo 1e6237977b 2025-12-15 00:24:40 +08:00
MarkLo 1cacc8d0be 2025-12-14 23:30:41 +08:00