From 2daeb1e2ae17a9e4ad6ee43be94d7fe0bee6a1f3 Mon Sep 17 00:00:00 2001 From: Daniel Bedeleanu Date: Tue, 21 Apr 2026 15:23:12 +0300 Subject: [PATCH] fix: use SERVER_IP from network config for backend API calls from VPN When accessing from VPN/Tailscale (e.g., 100.78.182.28), frontend was trying to reach backend on that same IP, but backend listens on SERVER_IP instead. Now uses SERVER_IP from network.json config, ensuring remote clients connect to the correct server address regardless of their access network. --- frontend/lib/api.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/lib/api.ts b/frontend/lib/api.ts index f8a661f0..b9541f46 100644 --- a/frontend/lib/api.ts +++ b/frontend/lib/api.ts @@ -29,10 +29,12 @@ export const getNetworkConfig = async () => { export const getBackendUrl = async () => { const config = await getNetworkConfig(); - + if (typeof window === 'undefined') return `http://localhost:${config.BACKEND_PORT}`; - const host = window.location.hostname; + // Use SERVER_IP from config (set during startup) instead of window.location.hostname + // This ensures VPN/remote clients connect to the correct server IP, not their access IP + const host = config.SERVER_IP || window.location.hostname; // If we are on HTTPS (Proxy/Mobile mode), we use the SSL port for the backend if (window.location.protocol === 'https:') {