mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-12-10 12:00:28 +08:00
优化WAF动作“显示网页”显示
This commit is contained in:
@@ -39,7 +39,23 @@ func (this *PageAction) Perform(waf *WAF, group *RuleGroup, set *RuleSet, reques
|
|||||||
request.ProcessResponseHeaders(writer.Header(), this.Status)
|
request.ProcessResponseHeaders(writer.Header(), this.Status)
|
||||||
writer.Header().Set("Content-Type", "text/html; charset=utf-8")
|
writer.Header().Set("Content-Type", "text/html; charset=utf-8")
|
||||||
writer.WriteHeader(this.Status)
|
writer.WriteHeader(this.Status)
|
||||||
_, _ = writer.Write([]byte(request.Format(this.Body)))
|
|
||||||
|
var body = this.Body
|
||||||
|
if len(body) == 0 {
|
||||||
|
body = `<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<title>403 Forbidden</title>
|
||||||
|
<style>
|
||||||
|
address { line-height: 1.8; }
|
||||||
|
</style>
|
||||||
|
<body>
|
||||||
|
<h1>403 Forbidden By WAF</h1>
|
||||||
|
<address>Connection: ${remoteAddr} (Client) -> ${serverAddr} (Server)</address>
|
||||||
|
<address>Request ID: ${requestId}</address>
|
||||||
|
</body>
|
||||||
|
</html>`
|
||||||
|
}
|
||||||
|
_, _ = writer.Write([]byte(request.Format(body)))
|
||||||
|
|
||||||
return false, false
|
return false, false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user