Watch
1
0
Fork
You've already forked RedFlag
0

fix: agent install URL preserves port for non-localhost hosts

getServerUrl() was stripping the port when hostname != localhost,
generating install commands on port 80. Now uses window.location.port
directly — the browser's host:port is always reachable by the agent.
This commit is contained in:
Fimeg 2026-06-08 09:25:46 -04:00
commit 4dc750b687

View file

@ -83,11 +83,12 @@ const AgentManagement: React.FC = () => {
];
const getServerUrl = () => {
// API server port (31337) vs web UI port (31336) on local dev.
const protocol = window.location.protocol;
const hostname = window.location.hostname;
const port = hostname === 'localhost' || hostname === '127.0.0.1' ? ':31337' : '';
return `${protocol}//${hostname}${port}`;
// Use the host:port the browser is actually on — that's always reachable
// by the agent machine. The nginx proxy (:31336) forwards /api/ to the
// server; direct API access (:31337) also works.
const { protocol, hostname, port } = window.location;
const portSuffix = port ? `:${port}` : '';
return `${protocol}//${hostname}${portSuffix}`;
};
const generateInstallCommand = (platform: typeof platforms[0]) => {