mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-06 14:50:25 +08:00
可以配置是否在反向代理中添加X-Real-IP和X-Forwarded-*
This commit is contained in:
@@ -86,6 +86,7 @@ func (this *SettingAction) RunPost(params struct {
|
|||||||
RequestURI: reverseProxyConfig.RequestURI,
|
RequestURI: reverseProxyConfig.RequestURI,
|
||||||
StripPrefix: reverseProxyConfig.StripPrefix,
|
StripPrefix: reverseProxyConfig.StripPrefix,
|
||||||
AutoFlush: reverseProxyConfig.AutoFlush,
|
AutoFlush: reverseProxyConfig.AutoFlush,
|
||||||
|
AddHeaders: reverseProxyConfig.AddHeaders,
|
||||||
})
|
})
|
||||||
|
|
||||||
this.Success()
|
this.Success()
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ func (this *SettingAction) RunPost(params struct {
|
|||||||
RequestURI: reverseProxyConfig.RequestURI,
|
RequestURI: reverseProxyConfig.RequestURI,
|
||||||
StripPrefix: reverseProxyConfig.StripPrefix,
|
StripPrefix: reverseProxyConfig.StripPrefix,
|
||||||
AutoFlush: reverseProxyConfig.AutoFlush,
|
AutoFlush: reverseProxyConfig.AutoFlush,
|
||||||
|
AddHeaders: reverseProxyConfig.AddHeaders,
|
||||||
})
|
})
|
||||||
|
|
||||||
this.Success()
|
this.Success()
|
||||||
|
|||||||
@@ -17,14 +17,43 @@ Vue.component("reverse-proxy-box", {
|
|||||||
stripPrefix: "",
|
stripPrefix: "",
|
||||||
requestURI: "",
|
requestURI: "",
|
||||||
requestHost: "",
|
requestHost: "",
|
||||||
requestHostType: 0
|
requestHostType: 0,
|
||||||
|
addHeaders: []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let forwardHeaders = [
|
||||||
|
{
|
||||||
|
name: "X-Real-IP",
|
||||||
|
isChecked: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "X-Forwarded-For",
|
||||||
|
isChecked: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "X-Forwarded-By",
|
||||||
|
isChecked: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "X-Forwarded-Host",
|
||||||
|
isChecked: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "X-Forwarded-Proto",
|
||||||
|
isChecked: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
forwardHeaders.forEach(function (v) {
|
||||||
|
v.isChecked = reverseProxyConfig.addHeaders.$contains(v.name)
|
||||||
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
reverseProxyRef: reverseProxyRef,
|
reverseProxyRef: reverseProxyRef,
|
||||||
reverseProxyConfig: reverseProxyConfig,
|
reverseProxyConfig: reverseProxyConfig,
|
||||||
advancedVisible: false,
|
advancedVisible: false,
|
||||||
family: this.vFamily
|
family: this.vFamily,
|
||||||
|
forwardHeaders: forwardHeaders
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@@ -42,6 +71,13 @@ Vue.component("reverse-proxy-box", {
|
|||||||
},
|
},
|
||||||
changeAdvancedVisible: function (v) {
|
changeAdvancedVisible: function (v) {
|
||||||
this.advancedVisible = v
|
this.advancedVisible = v
|
||||||
|
},
|
||||||
|
changeAddHeader: function () {
|
||||||
|
this.reverseProxyConfig.addHeaders = this.forwardHeaders.filter(function (v) {
|
||||||
|
return v.isChecked
|
||||||
|
}).map(function (v) {
|
||||||
|
return v.name
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
template: `<div>
|
template: `<div>
|
||||||
@@ -77,6 +113,16 @@ Vue.component("reverse-proxy-box", {
|
|||||||
</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">
|
||||||
|
<tr v-show="family == null || family == 'http'">
|
||||||
|
<td>自动添加的Header</td>
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
<div style="width: 20em; float: left; margin-bottom: 1em" v-for="header in forwardHeaders" :key="header.name">
|
||||||
|
<checkbox v-model="header.isChecked" @input="changeAddHeader">{{header.name}}</checkbox>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr v-show="family == null || family == 'http'">
|
<tr v-show="family == null || family == 'http'">
|
||||||
<td>请求URI<em>(RequestURI)</em></td>
|
<td>请求URI<em>(RequestURI)</em></td>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
Reference in New Issue
Block a user