mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-13 06:50:25 +08:00
优化HTTP2、HTTP跳转
This commit is contained in:
@@ -208,3 +208,13 @@ func httpAcceptEncoding(acceptEncodings string, encoding string) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// 跳转到某个URL
|
||||
func httpRedirect(writer http.ResponseWriter, req *http.Request, url string, code int) {
|
||||
if len(writer.Header().Get("Content-Type")) == 0 {
|
||||
// 设置Content-Type,是为了让页面不输出链接
|
||||
writer.Header().Set("Content-Type", "text/html; charset=utf-8")
|
||||
}
|
||||
|
||||
http.Redirect(writer, req, url, code)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user