mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-13 11:53:34 +08:00
创建集群时增加“只允许绑定的域名访问”选项
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user