反向代理支持RequestPath、RequestURI等

This commit is contained in:
GoEdgeLab
2020-09-27 10:03:00 +08:00
parent 7be35b2965
commit 09763d4d60
20 changed files with 281 additions and 165 deletions

View File

@@ -5,7 +5,6 @@ import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
"github.com/iwind/TeaGo/actions"
"github.com/iwind/TeaGo/maps"
)
@@ -39,6 +38,7 @@ func (this *IndexAction) RunGet(params struct {
this.ErrorPage(err)
return
}
this.Data["reverseProxyRef"] = reverseProxyRef
reverseProxy := &serverconfigs.ReverseProxyConfig{}
err = json.Unmarshal(reverseProxyResp.ReverseProxyJSON, reverseProxy)
@@ -46,10 +46,9 @@ func (this *IndexAction) RunGet(params struct {
this.ErrorPage(err)
return
}
this.Data["reverseProxyConfig"] = reverseProxy
this.Data["serverType"] = serverType
this.Data["reverseProxyRef"] = reverseProxyRef
this.Data["reverseProxyConfig"] = reverseProxy
primaryOriginMaps := []maps.Map{}
backupOriginMaps := []maps.Map{}
@@ -74,23 +73,3 @@ func (this *IndexAction) RunGet(params struct {
this.Show()
}
func (this *IndexAction) RunPost(params struct {
ServerId int64
ReverseProxyRefJSON []byte
Must *actions.Must
}) {
// TODO 校验配置
_, err := this.RPC().ServerRPC().UpdateServerReverseProxy(this.AdminContext(), &pb.UpdateServerReverseProxyRequest{
ServerId: params.ServerId,
ReverseProxyJSON: params.ReverseProxyRefJSON,
})
if err != nil {
this.ErrorPage(err)
return
}
this.Success()
}