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:
parent
7ae7429878
commit
4dc750b687
1 changed files with 6 additions and 5 deletions
|
|
@ -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]) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue