Skip to content

URGENT: Fix frontend localhost bug - merge to hosting-railway#3

Open
railway-app[bot] wants to merge 1 commit intohosting-railwayfrom
railway/code-change-algaOD
Open

URGENT: Fix frontend localhost bug - merge to hosting-railway#3
railway-app[bot] wants to merge 1 commit intohosting-railwayfrom
railway/code-change-algaOD

Conversation

@railway-app
Copy link
Copy Markdown

@railway-app railway-app Bot commented Apr 28, 2026

Problem

The frontend was showing BACKBONE OFFLINE in production because getApiBaseUrl() in api.ts and resolveBaseUrl() in intelligence/client.ts both constructed the API URL using window.location.hostname:8000. In production, this resolves to the frontend's Railway hostname on port 8000, which is not publicly routable — causing every API call to fail.

Solution

Added a PRODUCTION_API_URL constant pointing to https://thesphere-production-4aea.up.railway.app in both files. Both URL resolver functions now check if the hostname is not localhost or 127.0.0.1 and, when in production, return the hardcoded public backend URL instead of constructing a broken hostname:port URL. The NEXT_PUBLIC_API_BASE_URL env var override is still respected as the highest-priority option.

Changes

  • Modified frontend/src/lib/api.ts
  • Modified frontend/src/lib/intelligence/client.ts

Generated by Railway

@railway-app railway-app Bot temporarily deployed to pacific-grace / production April 28, 2026 03:29 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants