diff --git a/internal/web/actions/default/clusters/clusterutils/cluster_helper.go b/internal/web/actions/default/clusters/clusterutils/cluster_helper.go index de0d138d..e3bfa4d3 100644 --- a/internal/web/actions/default/clusters/clusterutils/cluster_helper.go +++ b/internal/web/actions/default/clusters/clusterutils/cluster_helper.go @@ -97,11 +97,6 @@ func (this *ClusterHelper) createSettingMenu(cluster *pb.NodeCluster, info *pb.F "isActive": selectedItem == "basic", "isOn": true, }) - items = append(items, maps.Map{ - "name": "服务设置", - "url": "/clusters/cluster/settings/global-server-config?clusterId=" + clusterId, - "isActive": selectedItem == "globalServerConfig", - }) items = append(items, maps.Map{ "name": "缓存设置", "url": "/clusters/cluster/settings/cache?clusterId=" + clusterId, @@ -158,6 +153,12 @@ func (this *ClusterHelper) createSettingMenu(cluster *pb.NodeCluster, info *pb.F "isOn": info != nil && info.HasDDoSProtection, }) + items = append(items, maps.Map{ + "name": "服务设置", + "url": "/clusters/cluster/settings/global-server-config?clusterId=" + clusterId, + "isActive": selectedItem == "globalServerConfig", + }) + items = append(items, maps.Map{ "name": "-", }) diff --git a/internal/web/actions/default/clusters/create.go b/internal/web/actions/default/clusters/create.go index ec3ba712..c15fbac5 100644 --- a/internal/web/actions/default/clusters/create.go +++ b/internal/web/actions/default/clusters/create.go @@ -7,6 +7,7 @@ import ( "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/dns/domains/domainutils" "github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" + "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" "github.com/iwind/TeaGo/actions" ) @@ -55,6 +56,9 @@ func (this *CreateAction) RunPost(params struct { // WAF策略 HttpFirewallPolicyId int64 + // 服务配置 + MatchDomainStrictly bool + // SSH相关 GrantId int64 InstallDir string @@ -93,6 +97,15 @@ func (this *CreateAction) RunPost(params struct { // TODO 检查DnsDomainId的有效性 + // 全局服务配置 + var globalServerConfig = serverconfigs.DefaultGlobalServerConfig() + globalServerConfig.HTTPAll.MatchDomainStrictly = params.MatchDomainStrictly + globalServerConfigJSON, err := json.Marshal(globalServerConfig) + if err != nil { + this.ErrorPage(err) + return + } + // 系统服务 var systemServices = map[string]any{} if params.SystemdServiceIsOn { @@ -107,15 +120,16 @@ func (this *CreateAction) RunPost(params struct { } createResp, err := this.RPC().NodeClusterRPC().CreateNodeCluster(this.AdminContext(), &pb.CreateNodeClusterRequest{ - Name: params.Name, - NodeGrantId: params.GrantId, - InstallDir: params.InstallDir, - DnsDomainId: params.DnsDomainId, - DnsName: params.DnsName, - DnsTTL: params.DnsTTL, - HttpCachePolicyId: params.CachePolicyId, - HttpFirewallPolicyId: params.HttpFirewallPolicyId, - SystemServicesJSON: systemServicesJSON, + Name: params.Name, + NodeGrantId: params.GrantId, + InstallDir: params.InstallDir, + DnsDomainId: params.DnsDomainId, + DnsName: params.DnsName, + DnsTTL: params.DnsTTL, + HttpCachePolicyId: params.CachePolicyId, + HttpFirewallPolicyId: params.HttpFirewallPolicyId, + SystemServicesJSON: systemServicesJSON, + GlobalServerConfigJSON: globalServerConfigJSON, }) if err != nil { this.ErrorPage(err) diff --git a/internal/web/actions/default/servers/components/index.go b/internal/web/actions/default/servers/components/index.go index 86db960d..b1a4bfc8 100644 --- a/internal/web/actions/default/servers/components/index.go +++ b/internal/web/actions/default/servers/components/index.go @@ -7,7 +7,6 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" "github.com/iwind/TeaGo/actions" - "github.com/iwind/TeaGo/maps" ) const ( @@ -65,7 +64,7 @@ func (this *IndexAction) RunPost(params struct { DefaultDomain string }) { // 创建日志 - defer this.CreateLog(oplogs.LevelInfo, "保存代理服务全局配置") + defer this.CreateLog(oplogs.LevelInfo, "保存网站服务全局配置") if len(params.GlobalConfigJSON) == 0 { this.Fail("错误的配置信息,请刷新当前页面后重试") @@ -84,27 +83,6 @@ func (this *IndexAction) RunPost(params struct { allowMismatchDomains = append(allowMismatchDomains, domain) } } - globalConfig.HTTPAll.AllowMismatchDomains = allowMismatchDomains - - // 不匹配域名的动作 - switch params.DomainMismatchAction { - case "close": - globalConfig.HTTPAll.DomainMismatchAction = &serverconfigs.DomainMismatchAction{ - Code: "close", - Options: nil, - } - case "page": - if params.DomainMismatchActionPageStatusCode <= 0 { - params.DomainMismatchActionPageStatusCode = 404 - } - globalConfig.HTTPAll.DomainMismatchAction = &serverconfigs.DomainMismatchAction{ - Code: "page", - Options: maps.Map{ - "statusCode": params.DomainMismatchActionPageStatusCode, - "contentHTML": params.DomainMismatchActionPageContentHTML, - }, - } - } // TCP端口范围 if params.TcpAllPortRangeMin < 1024 { diff --git a/web/public/js/components/common/checkbox.js b/web/public/js/components/common/checkbox.js index 6c130bee..4892dba9 100644 --- a/web/public/js/components/common/checkbox.js +++ b/web/public/js/components/common/checkbox.js @@ -47,6 +47,6 @@ Vue.component("checkbox", { }, template: `
为可选项。集群中的网站服务可以自行设置是否启用此设置。
+选中后,表示只有已经绑定(
当节点没有单独设置SSH登录方式时,默认使用此设置。
+当前集群下节点统一的登录设置;当节点没有单独设置SSH登录方式时,默认使用此设置。