// ServeHTTP implements caddyhttp.MiddlewareHandler.
ServeHTTP implements caddyhttp.MiddlewareHandler.
// ServeHTTP implements caddyhttp . MiddlewareHandler .
func (w CaddyWaf) ServeHTTP(rw http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error {
	remoteAddr := w.getRemoteIp(r)
	if w.detectIp(remoteAddr, false) {
		return next.ServeHTTP(rw, r)
	}
	if w.detectIp(remoteAddr, true) ||
		w.detectRequestArgs(r) ||
		w.detectRequestBody(r) ||
		w.detectUserAgent(r) ||
		w.rateLimit.detect(remoteAddr, r) {
		return w.redirectIntercept(rw)
	}
	return next.ServeHTTP(rw, r)
}
func ( w CaddyWaf ) ServeHTTP ( rw http . ResponseWriter , r * http . Request , next caddyhttp . Handler ) error { remoteAddr := w . getRemoteIp ( r ) if w . detectIp ( remoteAddr , false ) { return next . ServeHTTP ( rw , r ) } if w . detectIp ( remoteAddr , true ) || w . detectRequestArgs ( r ) || w . detectRequestBody ( r ) || w . detectUserAgent ( r ) || w . rateLimit . detect ( remoteAddr , r ) { return w . redirectIntercept ( rw ) } return next . ServeHTTP ( rw , r ) }
ServeHTTP implements caddyhttp.MiddlewareHandler.
ServeHTTP implements caddyhttp . MiddlewareHandler .
//ip allow rule