mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-23 23:30:25 +08:00
修复访问日志无法记录自定义跳转状态码的问题
This commit is contained in:
@@ -55,7 +55,7 @@ func (this *HTTPRequest) doHostRedirect() (blocked bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.ProcessResponseHeaders(this.writer.Header(), status)
|
this.ProcessResponseHeaders(this.writer.Header(), status)
|
||||||
http.Redirect(this.RawWriter, this.RawReq, afterURL, status)
|
httpRedirect(this.writer, this.RawReq, afterURL, status)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
} else if u.MatchRegexp { // 正则匹配
|
} else if u.MatchRegexp { // 正则匹配
|
||||||
@@ -97,7 +97,7 @@ func (this *HTTPRequest) doHostRedirect() (blocked bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.ProcessResponseHeaders(this.writer.Header(), status)
|
this.ProcessResponseHeaders(this.writer.Header(), status)
|
||||||
http.Redirect(this.RawWriter, this.RawReq, afterURL, status)
|
httpRedirect(this.writer, this.RawReq, afterURL, status)
|
||||||
return true
|
return true
|
||||||
} else { // 精准匹配
|
} else { // 精准匹配
|
||||||
if fullURL == u.RealBeforeURL() {
|
if fullURL == u.RealBeforeURL() {
|
||||||
@@ -120,7 +120,7 @@ func (this *HTTPRequest) doHostRedirect() (blocked bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.ProcessResponseHeaders(this.writer.Header(), status)
|
this.ProcessResponseHeaders(this.writer.Header(), status)
|
||||||
http.Redirect(this.RawWriter, this.RawReq, afterURL, status)
|
httpRedirect(this.writer, this.RawReq, afterURL, status)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -163,7 +163,7 @@ func (this *HTTPRequest) doHostRedirect() (blocked bool) {
|
|||||||
afterURL += this.uri[qIndex:]
|
afterURL += this.uri[qIndex:]
|
||||||
}
|
}
|
||||||
|
|
||||||
http.Redirect(this.RawWriter, this.RawReq, afterURL, status)
|
httpRedirect(this.writer, this.RawReq, afterURL, status)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
} else if u.Type == serverconfigs.HTTPHostRedirectTypePort {
|
} else if u.Type == serverconfigs.HTTPHostRedirectTypePort {
|
||||||
@@ -212,7 +212,7 @@ func (this *HTTPRequest) doHostRedirect() (blocked bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.ProcessResponseHeaders(this.writer.Header(), status)
|
this.ProcessResponseHeaders(this.writer.Header(), status)
|
||||||
http.Redirect(this.RawWriter, this.RawReq, afterURL, status)
|
httpRedirect(this.writer, this.RawReq, afterURL, status)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ func (this *HTTPRequest) doRedirectToHTTPS(redirectToHTTPSConfig *serverconfigs.
|
|||||||
|
|
||||||
var newURL = "https://" + host + this.RawReq.RequestURI
|
var newURL = "https://" + host + this.RawReq.RequestURI
|
||||||
this.ProcessResponseHeaders(this.writer.Header(), statusCode)
|
this.ProcessResponseHeaders(this.writer.Header(), statusCode)
|
||||||
http.Redirect(this.writer, this.RawReq, newURL, statusCode)
|
httpRedirect(this.writer, this.RawReq, newURL, statusCode)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,10 +31,10 @@ func (this *HTTPRequest) doRewrite() (shouldShop bool) {
|
|||||||
if this.rewriteRule.Mode == serverconfigs.HTTPRewriteModeRedirect {
|
if this.rewriteRule.Mode == serverconfigs.HTTPRewriteModeRedirect {
|
||||||
if this.rewriteRule.RedirectStatus > 0 {
|
if this.rewriteRule.RedirectStatus > 0 {
|
||||||
this.ProcessResponseHeaders(this.writer.Header(), this.rewriteRule.RedirectStatus)
|
this.ProcessResponseHeaders(this.writer.Header(), this.rewriteRule.RedirectStatus)
|
||||||
http.Redirect(this.writer, this.RawReq, this.rewriteReplace, this.rewriteRule.RedirectStatus)
|
httpRedirect(this.writer, this.RawReq, this.rewriteReplace, this.rewriteRule.RedirectStatus)
|
||||||
} else {
|
} else {
|
||||||
this.ProcessResponseHeaders(this.writer.Header(), http.StatusTemporaryRedirect)
|
this.ProcessResponseHeaders(this.writer.Header(), http.StatusTemporaryRedirect)
|
||||||
http.Redirect(this.writer, this.RawReq, this.rewriteReplace, http.StatusTemporaryRedirect)
|
httpRedirect(this.writer, this.RawReq, this.rewriteReplace, http.StatusTemporaryRedirect)
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -908,7 +908,7 @@ func (this *HTTPWriter) SendResp(resp *http.Response) (int64, error) {
|
|||||||
|
|
||||||
// Redirect 跳转
|
// Redirect 跳转
|
||||||
func (this *HTTPWriter) Redirect(status int, url string) {
|
func (this *HTTPWriter) Redirect(status int, url string) {
|
||||||
http.Redirect(this.rawWriter, this.req.RawReq, url, status)
|
httpRedirect(this, this.req.RawReq, url, status)
|
||||||
this.isFinished = true
|
this.isFinished = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user