feat(oauth2): add dashboard_host setting for callback URL

Decouple OAuth2 callback host from agent install host. When dashboard_host
is empty, the request Host is passed through; otherwise non-reserved hosts
are pinned to dashboard_host. Added to reserved-host allowlist for NAT.
This commit is contained in:
naiba
2026-06-06 05:03:12 +00:00
parent c595728609
commit 66de244c2e
6 changed files with 42 additions and 22 deletions
+5
View File
@@ -45,6 +45,11 @@ type ConfigDashboard struct {
InstallHost string `koanf:"install_host" json:"install_host,omitempty"`
AgentTLS bool `koanf:"tls" json:"tls,omitempty"` // 用于前端判断生成的安装命令是否启用 TLS
// DashboardHost 是 dashboard 对外访问的主机名,专用于 OAuth2 回调地址。
// 它与 InstallHostagent 连接用主机名)解耦:两者可以是不同域名。
// 为空时,OAuth2 回调放行请求 Host(信任请求头),不做强制重写。
DashboardHost string `koanf:"dashboard_host" json:"dashboard_host,omitempty"`
WebRealIPHeader string `koanf:"web_real_ip_header" json:"web_real_ip_header,omitempty"` // 前端真实IP
AgentRealIPHeader string `koanf:"agent_real_ip_header" json:"agent_real_ip_header,omitempty"` // Agent真实IP
UserTemplate string `koanf:"user_template" json:"user_template,omitempty"`