支持URL跳转

This commit is contained in:
GoEdgeLab
2021-01-10 19:10:42 +08:00
parent 3499132598
commit e5a634c5ac
3 changed files with 35 additions and 1 deletions

View File

@@ -148,6 +148,13 @@ func (this *HTTPRequest) Do() {
// 开始调用
func (this *HTTPRequest) doBegin() {
// 跳转
if len(this.web.HostRedirects) > 0 {
if this.doHostRedirect() {
return
}
}
// 特殊URL处理
if len(this.rawURI) > 1 && this.rawURI[1] == '.' {
// ACME
@@ -309,6 +316,11 @@ func (this *HTTPRequest) configureWeb(web *serverconfigs.HTTPWebConfig, isTop bo
this.web.AccessLogRef = web.AccessLogRef
}
// host redirects
if len(web.HostRedirects) > 0 {
this.web.HostRedirects = web.HostRedirects
}
// 重写规则
if len(web.RewriteRefs) > 0 {
for index, ref := range web.RewriteRefs {