增加防盗链拦截时默认提示文字

This commit is contained in:
GoEdgeLab
2022-09-22 17:52:57 +08:00
parent 393e2f9878
commit efe6cbc881
4 changed files with 20 additions and 10 deletions
+3 -3
View File
@@ -19,7 +19,7 @@ func (this *HTTPRequest) doCheckReferers() (shouldStop bool) {
}
this.tags = append(this.tags, "refererCheck")
this.writer.WriteHeader(http.StatusForbidden)
this.writeCode(http.StatusForbidden, "The referer has been blocked.", "当前访问已被防盗链系统拦截。")
return true
}
@@ -31,14 +31,14 @@ func (this *HTTPRequest) doCheckReferers() (shouldStop bool) {
}
this.tags = append(this.tags, "refererCheck")
this.writer.WriteHeader(http.StatusForbidden)
this.writeCode(http.StatusForbidden, "The referer has been blocked.", "当前访问已被防盗链系统拦截。")
return true
}
if !this.web.Referers.MatchDomain(this.ReqHost, u.Host) {
this.tags = append(this.tags, "refererCheck")
this.writer.WriteHeader(http.StatusForbidden)
this.writeCode(http.StatusForbidden, "The referer has been blocked.", "当前访问已被防盗链系统拦截。")
return true
}
return