mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-08 07:50:28 +08:00
反向代理设置中增加移除回源主机名端口功能
This commit is contained in:
@@ -55,9 +55,7 @@ func (this *SettingAction) RunPost(params struct {
|
|||||||
}) {
|
}) {
|
||||||
defer this.CreateLogInfo("修改代理服务 %d 的反向代理设置", params.ServerId)
|
defer this.CreateLogInfo("修改代理服务 %d 的反向代理设置", params.ServerId)
|
||||||
|
|
||||||
// TODO 校验配置
|
var reverseProxyConfig = &serverconfigs.ReverseProxyConfig{}
|
||||||
|
|
||||||
reverseProxyConfig := &serverconfigs.ReverseProxyConfig{}
|
|
||||||
err := json.Unmarshal(params.ReverseProxyJSON, reverseProxyConfig)
|
err := json.Unmarshal(params.ReverseProxyJSON, reverseProxyConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
@@ -118,20 +116,21 @@ func (this *SettingAction) RunPost(params struct {
|
|||||||
|
|
||||||
// 设置反向代理相关信息
|
// 设置反向代理相关信息
|
||||||
_, err = this.RPC().ReverseProxyRPC().UpdateReverseProxy(this.AdminContext(), &pb.UpdateReverseProxyRequest{
|
_, err = this.RPC().ReverseProxyRPC().UpdateReverseProxy(this.AdminContext(), &pb.UpdateReverseProxyRequest{
|
||||||
ReverseProxyId: reverseProxyConfig.Id,
|
ReverseProxyId: reverseProxyConfig.Id,
|
||||||
RequestHostType: types.Int32(reverseProxyConfig.RequestHostType),
|
RequestHostType: types.Int32(reverseProxyConfig.RequestHostType),
|
||||||
RequestHost: reverseProxyConfig.RequestHost,
|
RequestHost: reverseProxyConfig.RequestHost,
|
||||||
RequestURI: reverseProxyConfig.RequestURI,
|
RequestURI: reverseProxyConfig.RequestURI,
|
||||||
StripPrefix: reverseProxyConfig.StripPrefix,
|
StripPrefix: reverseProxyConfig.StripPrefix,
|
||||||
AutoFlush: reverseProxyConfig.AutoFlush,
|
AutoFlush: reverseProxyConfig.AutoFlush,
|
||||||
AddHeaders: reverseProxyConfig.AddHeaders,
|
AddHeaders: reverseProxyConfig.AddHeaders,
|
||||||
ConnTimeoutJSON: connTimeoutJSON,
|
ConnTimeoutJSON: connTimeoutJSON,
|
||||||
ReadTimeoutJSON: readTimeoutJSON,
|
ReadTimeoutJSON: readTimeoutJSON,
|
||||||
IdleTimeoutJSON: idleTimeoutJSON,
|
IdleTimeoutJSON: idleTimeoutJSON,
|
||||||
MaxConns: types.Int32(reverseProxyConfig.MaxConns),
|
MaxConns: types.Int32(reverseProxyConfig.MaxConns),
|
||||||
MaxIdleConns: types.Int32(reverseProxyConfig.MaxIdleConns),
|
MaxIdleConns: types.Int32(reverseProxyConfig.MaxIdleConns),
|
||||||
ProxyProtocolJSON: proxyProtocolJSON,
|
ProxyProtocolJSON: proxyProtocolJSON,
|
||||||
FollowRedirects: reverseProxyConfig.FollowRedirects,
|
FollowRedirects: reverseProxyConfig.FollowRedirects,
|
||||||
|
RequestHostExcludingPort: reverseProxyConfig.RequestHostExcludingPort,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ Vue.component("reverse-proxy-box", {
|
|||||||
requestURI: "",
|
requestURI: "",
|
||||||
requestHost: "",
|
requestHost: "",
|
||||||
requestHostType: 0,
|
requestHostType: 0,
|
||||||
|
requestHostExcludingPort: false,
|
||||||
addHeaders: [],
|
addHeaders: [],
|
||||||
connTimeout: {count: 0, unit: "second"},
|
connTimeout: {count: 0, unit: "second"},
|
||||||
readTimeout: {count: 0, unit: "second"},
|
readTimeout: {count: 0, unit: "second"},
|
||||||
@@ -169,18 +170,24 @@ Vue.component("reverse-proxy-box", {
|
|||||||
<tr v-show="family == null || family == 'http'">
|
<tr v-show="family == null || family == 'http'">
|
||||||
<td>回源主机名<em>(Host)</em></td>
|
<td>回源主机名<em>(Host)</em></td>
|
||||||
<td>
|
<td>
|
||||||
<radio :v-value="0" v-model="reverseProxyConfig.requestHostType">跟随代理服务</radio>
|
<radio :v-value="0" v-model="reverseProxyConfig.requestHostType">跟随CDN域名</radio>
|
||||||
<radio :v-value="1" v-model="reverseProxyConfig.requestHostType">跟随源站</radio>
|
<radio :v-value="1" v-model="reverseProxyConfig.requestHostType">跟随源站</radio>
|
||||||
<radio :v-value="2" v-model="reverseProxyConfig.requestHostType">自定义</radio>
|
<radio :v-value="2" v-model="reverseProxyConfig.requestHostType">自定义</radio>
|
||||||
<div v-show="reverseProxyConfig.requestHostType == 2" style="margin-top: 0.8em">
|
<div v-show="reverseProxyConfig.requestHostType == 2" style="margin-top: 0.8em">
|
||||||
<input type="text" placeholder="比如example.com" v-model="reverseProxyConfig.requestHost"/>
|
<input type="text" placeholder="比如example.com" v-model="reverseProxyConfig.requestHost"/>
|
||||||
</div>
|
</div>
|
||||||
<p class="comment">请求源站时的Host,用于修改源站接收到的域名
|
<p class="comment">请求源站时的Host,用于修改源站接收到的域名
|
||||||
<span v-if="reverseProxyConfig.requestHostType == 0">,"跟随代理服务"是指源站接收到的域名和当前代理服务保持一致</span>
|
<span v-if="reverseProxyConfig.requestHostType == 0">,"跟随CDN域名"是指源站接收到的域名和当前CDN访问域名保持一致</span>
|
||||||
<span v-if="reverseProxyConfig.requestHostType == 1">,"跟随源站"是指源站接收到的域名仍然是填写的源站地址中的信息,不随代理服务域名改变而改变</span>
|
<span v-if="reverseProxyConfig.requestHostType == 1">,"跟随源站"是指源站接收到的域名仍然是填写的源站地址中的信息,不随代理服务域名改变而改变</span>
|
||||||
<span v-if="reverseProxyConfig.requestHostType == 2">,自定义Host内容中支持请求变量</span>。</p>
|
<span v-if="reverseProxyConfig.requestHostType == 2">,自定义Host内容中支持请求变量</span>。</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr v-show="family == null || family == 'http'">
|
||||||
|
<td>回源主机名不包含端口</td>
|
||||||
|
<td><checkbox v-model="reverseProxyConfig.requestHostExcludingPort"></checkbox>
|
||||||
|
<p class="comment">选中后表示移除回源主机名中的端口部分。</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
<more-options-tbody @change="changeAdvancedVisible" v-if="isOn()"></more-options-tbody>
|
<more-options-tbody @change="changeAdvancedVisible" v-if="isOn()"></more-options-tbody>
|
||||||
<tbody v-show="isOn() && advancedVisible">
|
<tbody v-show="isOn() && advancedVisible">
|
||||||
|
|||||||
Reference in New Issue
Block a user