mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-09 20:10:27 +08:00
反向代理设置中增加移除回源主机名端口功能
This commit is contained in:
@@ -146,6 +146,12 @@ func (this *HTTPRequest) doReverseProxy() {
|
||||
} else {
|
||||
this.RawReq.Host = requestHost
|
||||
}
|
||||
|
||||
// 是否移除端口
|
||||
if this.reverseProxy.RequestHostExcludingPort {
|
||||
this.RawReq.Host = utils.ParseAddrHost(this.RawReq.Host)
|
||||
}
|
||||
|
||||
this.RawReq.URL.Host = this.RawReq.Host
|
||||
} else if this.reverseProxy.RequestHostType == serverconfigs.RequestHostTypeOrigin {
|
||||
// 源站主机名
|
||||
@@ -157,9 +163,21 @@ func (this *HTTPRequest) doReverseProxy() {
|
||||
}
|
||||
|
||||
this.RawReq.Host = hostname
|
||||
|
||||
// 是否移除端口
|
||||
if this.reverseProxy.RequestHostExcludingPort {
|
||||
this.RawReq.Host = utils.ParseAddrHost(this.RawReq.Host)
|
||||
}
|
||||
|
||||
this.RawReq.URL.Host = this.RawReq.Host
|
||||
} else {
|
||||
this.RawReq.URL.Host = this.ReqHost
|
||||
|
||||
// 是否移除端口
|
||||
if this.reverseProxy.RequestHostExcludingPort {
|
||||
this.RawReq.Host = utils.ParseAddrHost(this.RawReq.Host)
|
||||
this.RawReq.URL.Host = utils.ParseAddrHost(this.RawReq.URL.Host)
|
||||
}
|
||||
}
|
||||
|
||||
// 重组请求URL
|
||||
|
||||
Reference in New Issue
Block a user