mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-27 13:40:25 +08:00
TLS源站支持填写回源主机名
This commit is contained in:
@@ -98,7 +98,7 @@ func (this *AddPopupAction) RunPost(params struct {
|
||||
} else if params.Protocol == "https" {
|
||||
addr += ":443"
|
||||
} else {
|
||||
this.Fail("地址中需要带有端口")
|
||||
this.FailField("addr", "源站地址中需要带有端口")
|
||||
}
|
||||
portIndex = strings.LastIndex(addr, ":")
|
||||
}
|
||||
@@ -107,19 +107,19 @@ func (this *AddPopupAction) RunPost(params struct {
|
||||
|
||||
// 检查端口号
|
||||
if port == "0" {
|
||||
this.Fail("端口号不能为0")
|
||||
this.FailField("addr", "源站端口号不能为0")
|
||||
}
|
||||
if !configutils.HasVariables(port) {
|
||||
// 必须是整数
|
||||
if !regexp.MustCompile(`^\d+$`).MatchString(port) {
|
||||
this.Fail("端口号只能为整数")
|
||||
this.FailField("addr", "源站端口号只能为整数")
|
||||
}
|
||||
var portInt = types.Int(port)
|
||||
if portInt == 0 {
|
||||
this.Fail("端口号不能为0")
|
||||
this.FailField("addr", "源站端口号不能为0")
|
||||
}
|
||||
if portInt > 65535 {
|
||||
this.Fail("端口号不能大于65535")
|
||||
this.FailField("addr", "源站端口号不能大于65535")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -164,7 +164,7 @@ func (this *UpdatePopupAction) RunPost(params struct {
|
||||
} else if params.Protocol == "https" {
|
||||
addr += ":443"
|
||||
} else {
|
||||
this.Fail("地址中需要带有端口")
|
||||
this.FailField("addr", "源站地址中需要带有端口")
|
||||
}
|
||||
portIndex = strings.LastIndex(addr, ":")
|
||||
}
|
||||
@@ -172,19 +172,19 @@ func (this *UpdatePopupAction) RunPost(params struct {
|
||||
var port = addr[portIndex+1:]
|
||||
// 检查端口号
|
||||
if port == "0" {
|
||||
this.Fail("端口号不能为0")
|
||||
this.FailField("addr", "源站端口号不能为0")
|
||||
}
|
||||
if !configutils.HasVariables(port) {
|
||||
// 必须是整数
|
||||
if !regexp.MustCompile(`^\d+$`).MatchString(port) {
|
||||
this.Fail("端口号只能为整数")
|
||||
this.FailField("addr", "源站端口号只能为整数")
|
||||
}
|
||||
var portInt = types.Int(port)
|
||||
if portInt == 0 {
|
||||
this.Fail("端口号不能为0")
|
||||
this.FailField("addr", "源站端口号不能为0")
|
||||
}
|
||||
if portInt > 65535 {
|
||||
this.Fail("端口号不能大于65535")
|
||||
this.FailField("addr", "源站端口号不能大于65535")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
</select>
|
||||
|
||||
<!-- TCP -->
|
||||
<select class="ui dropdown auto-width" name="protocol" v-if="serverType == 'tcpProxy'">
|
||||
<select class="ui dropdown auto-width" name="protocol" v-model="protocol" v-if="serverType == 'tcpProxy'">
|
||||
<option value="tcp">TCP</option>
|
||||
<option value="tls">TLS</option>
|
||||
</select>
|
||||
|
||||
<!-- UDP -->
|
||||
<select class="ui dropdown auto-width" name="protocol" v-if="serverType == 'udpProxy'">
|
||||
<select class="ui dropdown auto-width" name="protocol" v-model="protocol" v-if="serverType == 'udpProxy'">
|
||||
<option value="udp">UDP</option>
|
||||
</select>
|
||||
</td>
|
||||
@@ -45,11 +45,11 @@
|
||||
<ssl-certs-box :v-single-mode="true" :v-view-size="'mini'" :v-description="'可以选择连接源站使用的证书。'"></ssl-certs-box>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="isHTTP">
|
||||
<tr v-if="isHTTP || protocol == 'tls'">
|
||||
<td>回源主机名</td>
|
||||
<td>
|
||||
<input type="text" name="host" placeholder="比如example.com" maxlength="100"/>
|
||||
<p class="comment">请求源站时的Host,用于修改源站接收到的域名,自定义Host内容中支持请求变量。</p>
|
||||
<p class="comment">请求源站时的Host,用于修改源站接收到的域名<span v-if="isHTTP">,自定义Host内容中支持请求变量</span>。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="isHTTP">
|
||||
|
||||
@@ -6,6 +6,10 @@ Tea.context(function () {
|
||||
|
||||
if (this.isHTTP) {
|
||||
this.protocol = "http"
|
||||
} else if (this.serverType == "tcpProxy") {
|
||||
this.protocol = "tcp"
|
||||
} else if (this.serverType == "udpProxy") {
|
||||
this.protocol = "udp"
|
||||
}
|
||||
|
||||
this.changeProtocol = function () {
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
<ssl-certs-box :v-single-mode="true" :v-cert="origin.cert" :v-view-size="'mini'" :v-description="'可以选择连接源站使用的证书。'"></ssl-certs-box>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="isHTTP">
|
||||
<tr v-if="isHTTP || origin.protocol == 'tls'">
|
||||
<td>回源主机名</td>
|
||||
<td>
|
||||
<input type="text" name="host" v-model="origin.host" placeholder="比如example.com" maxlength="100"/>
|
||||
|
||||
Reference in New Issue
Block a user