mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-06 18:10:26 +08:00
回源主机名为“跟随源站”时,获得的源站主机名去除常规端口80和443
This commit is contained in:
@@ -117,7 +117,15 @@ func (this *HTTPRequest) doReverseProxy() {
|
|||||||
}
|
}
|
||||||
this.RawReq.URL.Host = this.RawReq.Host
|
this.RawReq.URL.Host = this.RawReq.Host
|
||||||
} else if this.reverseProxy.RequestHostType == serverconfigs.RequestHostTypeOrigin {
|
} else if this.reverseProxy.RequestHostType == serverconfigs.RequestHostTypeOrigin {
|
||||||
this.RawReq.Host = originAddr
|
// 源站主机名
|
||||||
|
var hostname = originAddr
|
||||||
|
if origin.Addr.Protocol.IsHTTPFamily() {
|
||||||
|
hostname = strings.TrimSuffix(hostname, ":80")
|
||||||
|
} else if origin.Addr.Protocol.IsHTTPSFamily() {
|
||||||
|
hostname = strings.TrimSuffix(hostname, ":443")
|
||||||
|
}
|
||||||
|
|
||||||
|
this.RawReq.Host = hostname
|
||||||
this.RawReq.URL.Host = this.RawReq.Host
|
this.RawReq.URL.Host = this.RawReq.Host
|
||||||
} else {
|
} else {
|
||||||
this.RawReq.URL.Host = this.Host
|
this.RawReq.URL.Host = this.Host
|
||||||
|
|||||||
Reference in New Issue
Block a user