优化安全设置中“自定义客户端IP报头”中默认报头交互

This commit is contained in:
刘祥超
2024-03-10 12:02:41 +08:00
parent cbaa344467
commit dcf02f4509
2 changed files with 9 additions and 1 deletions

View File

@@ -61,7 +61,7 @@
<td>自定义客户端IP报头</td>
<td>
<input type="text" name="clientIPHeaderNames" v-model="config.clientIPHeaderNames"/>
<p class="comment">可以通过此报头获取客户端IP类似于<code-label>X-Forwarded-For</code-label><code-label>Client-IP</code-label>,用于使用反向代理访问管理系统的情形;如果有多个报头可以使用空格隔开。</p>
<p class="comment">可以通过此报头获取客户端IP类似于<code-label>X-Forwarded-For X-Real-IP Client-IP</code-label>&nbsp;<a href=""><span class="small" @click.prevent="addDefaultClientIPHeaderNames('X-Forwarded-For X-Real-IP Client-IP')">[填入]</span></a>,用于使用反向代理访问管理系统的情形;如果有多个报头可以使用空格隔开。</p>
</td>
</tr>
<tr>

View File

@@ -1,3 +1,11 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
this.addDefaultClientIPHeaderNames = function (headerNames) {
if (this.config.clientIPHeaderNames == null || this.config.clientIPHeaderNames.length == 0) {
this.config.clientIPHeaderNames = headerNames
} else {
this.config.clientIPHeaderNames += " " + headerNames
}
}
})