mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-19 04:10:30 +08:00
自动替换Location中的地址时检查域名是否为当前域名
This commit is contained in:
@@ -283,7 +283,7 @@ func (this *HTTPRequest) doReverseProxy() {
|
|||||||
var locationHeader = resp.Header.Get("Location")
|
var locationHeader = resp.Header.Get("Location")
|
||||||
if len(locationHeader) > 0 {
|
if len(locationHeader) > 0 {
|
||||||
locationURL, err := url.Parse(locationHeader)
|
locationURL, err := url.Parse(locationHeader)
|
||||||
if err == nil && (locationURL.Host == originAddr || strings.HasPrefix(originAddr, locationURL.Host+":")) {
|
if err == nil && locationURL.Host != this.ReqHost && (locationURL.Host == originAddr || strings.HasPrefix(originAddr, locationURL.Host+":")) {
|
||||||
locationURL.Host = this.ReqHost
|
locationURL.Host = this.ReqHost
|
||||||
if this.IsHTTP {
|
if this.IsHTTP {
|
||||||
locationURL.Scheme = "http"
|
locationURL.Scheme = "http"
|
||||||
|
|||||||
Reference in New Issue
Block a user