mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-30 12:10:25 +08:00
新建反向代理时默认选中所有Header
This commit is contained in:
@@ -159,7 +159,13 @@ func (this *ReverseProxyDAO) CreateReverseProxy(tx *dbs.Tx, adminId int64, userI
|
|||||||
op.State = ReverseProxyStateEnabled
|
op.State = ReverseProxyStateEnabled
|
||||||
op.AdminId = adminId
|
op.AdminId = adminId
|
||||||
op.UserId = userId
|
op.UserId = userId
|
||||||
op.AddHeaders = "[\"X-Real-IP\"]"
|
|
||||||
|
defaultHeaders := []string{"X-Real-IP", "X-Forwarded-For", "X-Forwarded-By", "X-Forwarded-Host", "X-Forwarded-Proto"}
|
||||||
|
defaultHeadersJSON, err := json.Marshal(defaultHeaders)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
op.AddHeaders = defaultHeadersJSON
|
||||||
|
|
||||||
if len(schedulingJSON) > 0 {
|
if len(schedulingJSON) > 0 {
|
||||||
op.Scheduling = string(schedulingJSON)
|
op.Scheduling = string(schedulingJSON)
|
||||||
@@ -170,7 +176,7 @@ func (this *ReverseProxyDAO) CreateReverseProxy(tx *dbs.Tx, adminId int64, userI
|
|||||||
if len(backupOriginsJSON) > 0 {
|
if len(backupOriginsJSON) > 0 {
|
||||||
op.BackupOrigins = string(backupOriginsJSON)
|
op.BackupOrigins = string(backupOriginsJSON)
|
||||||
}
|
}
|
||||||
err := this.Save(tx, op)
|
err = this.Save(tx, op)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user