Skip to content

Commit aed8753

Browse files
committed
Add console public_url for direct proxy
1 parent bcfcdf4 commit aed8753

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

host-agent/api/handlers.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ def __init__(
4949
self.state_manager = StateManager(agent_defaults)
5050
self.vnc_console = VNCConsoleManager(agent_defaults)
5151
self.console_tokens = console_token_manager
52+
console_cfg = agent_defaults.get("console", {}) if isinstance(agent_defaults, dict) else {}
53+
self.console_public_url = (console_cfg.get("public_url") or "").rstrip("/")
5254

5355
def v1_ui_config(self) -> Dict[str, Any]:
5456
cfg = self.ui_config or {}
@@ -496,8 +498,11 @@ def v1_vm_console_start(self, vm_name: str) -> Dict[str, Any]:
496498
info.get("password"),
497499
info.get("session_name", ""),
498500
)
501+
base_url = self.console_public_url
502+
if not base_url:
503+
raise HTTPException(status_code=500, detail="console.public_url not configured")
499504
console_obj = {
500-
"path": f"/console/ws/{token}",
505+
"url": f"{base_url}/console/ws/{token}",
501506
"protocol": "https",
502507
"passwordonetimeuseonly": True,
503508
}

host-agent/debian/firecracker-agent.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"xterm_geometry": "127x45",
2828
"font_family": "Monospace",
2929
"font_size": 10,
30+
"public_url": "https://YOUR-HOST:8443",
3031
"direct_proxy_enabled": false,
3132
"direct_token_ttl": 300
3233
}

host-agent/firecracker-agent.json-file-example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"font_family": "Monospace",
2929
"font_size": 10,
3030
"read_only": false,
31+
"public_url": "https://YOUR-HOST:8443",
3132
"direct_proxy_enabled": true,
3233
"direct_token_ttl": 300
3334
}

0 commit comments

Comments
 (0)