Skip to content

Commit dcf02f4

Browse files
committed
优化安全设置中“自定义客户端IP报头”中默认报头交互
1 parent cbaa344 commit dcf02f4

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

web/views/@default/settings/security/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
<td>自定义客户端IP报头</td>
6262
<td>
6363
<input type="text" name="clientIPHeaderNames" v-model="config.clientIPHeaderNames"/>
64-
<p class="comment">可以通过此报头获取客户端IP,类似于<code-label>X-Forwarded-For</code-label><code-label>Client-IP</code-label>,用于使用反向代理访问管理系统的情形;如果有多个报头可以使用空格隔开。</p>
64+
<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>
6565
</td>
6666
</tr>
6767
<tr>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
Tea.context(function () {
22
this.success = NotifyReloadSuccess("保存成功")
3+
4+
this.addDefaultClientIPHeaderNames = function (headerNames) {
5+
if (this.config.clientIPHeaderNames == null || this.config.clientIPHeaderNames.length == 0) {
6+
this.config.clientIPHeaderNames = headerNames
7+
} else {
8+
this.config.clientIPHeaderNames += " " + headerNames
9+
}
10+
}
311
})

0 commit comments

Comments
 (0)