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.
This commit is contained in:
@@ -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:') {
|
||||
|
||||
Reference in New Issue
Block a user