Support > About cybersecurity > Is your WAF constantly blocking legitimate traffic? A four-step debugging method to pinpoint issues in logs and precisely allow traffic.
Is your WAF constantly blocking legitimate traffic? A four-step debugging method to pinpoint issues in logs and precisely allow traffic.
Time : 2026-10-11 09:37:07
Edit : Jtti

On the first day the WAF went live, backend logins were blocked. On the second day, customer order notes triggered a block. By the third day, even images uploaded by internal operations staff were flagged as malicious files.

Security protection was in place, but business operations were being stifled by the very WAF meant to protect them. This is a classic dilemma for many DevOps engineers after deploying a WAF. With WAF logs showing nothing but "Block" entries, it becomes impossible to distinguish between genuine attacks and legitimate requests that merely *look* like attacks in terms of format.

False positives are harder to handle than false negatives. A false negative is a security issue that can be reviewed after the fact; a false positive is a business issue, where every blocked request risks driving away a real user. The core logic of tuning a WAF isn't about simply turning off rules; it’s about observing first, pinpointing the issue, and then selectively allowing legitimate traffic.

Step 1: Let the WAF "speak" before it "acts"

Most WAFs default to "blocking mode" upon deployment—the riskiest configuration possible. The correct approach is to switch the engine to "observation mode" (or "detection-only mode"): rules are still matched, but only logged, without blocking requests.

Take ModSecurity as an example: after installation, the default value for `SecRuleEngine` in `modsecurity.conf` is `DetectionOnly`—logging without blocking. This isn't a temporary workaround; it is an intentional observation period. It is recommended to run in this state for one or two days to accumulate sufficient baseline data regarding which parameters in your application's normal operation naturally resemble attack payloads.

Cloudflare’s managed rules also support a simulation mode, allowing you to record exactly when and how each rule is triggered without blocking traffic.

The output of this observation period is a "false positive candidate list": identifying which rules are frequently triggered, which URIs are hotspots, and which parameter values ​​are repeatedly flagged. Adjusting rules rashly without this data is like trying to fix a circuit while blindfolded.

Step 2: Pinpoint the "real culprit" from the logs

Once the observation period ends, you will have a large volume of WAF logs to analyze. The next critical step is to identify the specific rule ID that triggered the block and determine exactly what part of the request matched that rule.

Azure WAF logs explicitly record the `ruleId`, `requestUri`, `transactionId`, and details regarding the matched field. For instance, consider a legitimate comment submission blocked because it contained `comment="1=1"`; while the string "1=1" is a common indicator of SQL injection, in this specific business context, it is merely ordinary text entered by a user. The `details.data` field in the logs will pinpoint exactly which parameter value triggered the rule.

Cloudflare users can utilize the Payload Logging feature to capture the specific string that triggered a rule. This string is stored in an encrypted format using a key you provide, helping you determine whether the match represents a false positive or an actual attack.

The core principle here is to "rely on logs, not intuition." Do not disable a rule simply because a user reports being blocked; instead, use the logs to identify the precise rule ID and the matched field. While log formats vary across different WAFs, the key information remains consistent: rule ID, request URI, matched field name and value, and the action taken.

Step 3: Implement precise exclusions rather than blunt deactivation

Once the rule ID is identified, the immediate reaction for many is to simply disable that rule. This is the costliest approach, as disabling a rule removes protection against all the attack types that rule was designed to mitigate.

The correct approach is to implement a precise exclusion based on three dimensions: rule ID, parameter, and path.

Suppose you discover that rule 942110 is repeatedly generating false positives on the `comment` field for the `/api/Feedbacks/` endpoint. Instead of disabling rule 942110 entirely, you should create an exclusion rule: skip inspection by rule 942110 only when the request URI matches `/api/Feedbacks/` and the parameter name is `comment`. This ensures that the same `comment` parameter will still be inspected normally if it appears on other endpoints.

Azure WAF exclusion lists allow for precise configuration based on request attributes; excluded attributes are bypassed during WAF evaluation, while the remainder of the request undergoes standard inspection. Alibaba Cloud and Huawei Cloud offer similar allowlist mechanisms, enabling requests to bypass specific protection modules based on attributes such as IP address, User-Agent, or Referer.

For ModSecurity users, the `crs-setup.conf` file in the Core Rule Set (CRS) contains a critical parameter known as the "paranoia level" (ranging from 1 to 4). Level 1 yields the fewest false positives and is ideal for initial deployment; Level 2 expands detection coverage but increases the false positive rate. It is recommended that newly deployed sites start at Level 1 and gradually increase the level once the log baseline has stabilized.

Another easily overlooked scenario arises when a CDN or gateway proxy sits in front of the WAF: "Smart CC" (Challenge Collapsar) protection might misidentify the aggregated traffic from the proxy IP as an attack because it cannot detect the true client IP. In this case, you must correctly configure how the WAF retrieves client IPs—specifying headers like `X-Real-IP`, for instance—to prevent issues such as XFF (X-Forwarded-For) spoofing.

Step 4: Verification—Ensuring attacks remain blocked while legitimate traffic passes through

After every rule adjustment, perform a two-way verification: first, send a sample attack request to confirm it is still blocked; then, send a legitimate business request to confirm it no longer triggers a false positive.

Azure WAF allows you to use the "Log" action after adjustments to observe how a request is matched. This confirms that the action for Rule ID 942110 has changed from "Block" to "Log" and checks whether any other rules are still triggering a block for the same request. If multiple rules match a single request, you will need to configure exclusions for all of them, rather than just the first one.

Once verification is successful, switch the WAF engine from "Detection mode" (or "Observation mode") back to "Prevention mode" (or "Block mode"). Before switching, plan your rollback strategy: if business traffic is blocked again after the switch, you need to be able to quickly revert to detection mode rather than panicking and disabling the entire WAF.

Debugging a WAF is, at its core, about debugging your understanding of your own business.

WAF rule sets are designed based on generic attack patterns; they have no inherent knowledge of your specific business logic. On an online education platform, students discussing "how to use SQL statements for data analysis" within a course discussion forum represents a normal educational scenario; however, the appearance of SQL keywords in the "delivery address" field of an e-commerce platform signals an anomaly.

Rules are generally applicable, whereas exclusions are specific to the business logic. Every precise exclusion represents a clear definition of what constitutes "valid input" for a particular API endpoint. Consequently, the process of tuning a Web Application Firewall (WAF) is also an exercise in clarifying input specifications for business interfaces.

WAF best practice documentation emphasizes a crucial principle: the scope of impact for any rule adjustment must be clearly understood beforehand. Should baseline adjustments be applied at the global configuration level, or should they be narrowed down to the domain or even route level? For most deployments, it is recommended to first tune the baseline at the configuration set level and then apply specific exceptions at a more granular level to minimize operational impact.

Similarly, while Jtti’s Hong Kong CN2 VPS offers robust WAF protection, it relies on a dedicated CN2 GIA network backbone. Entry-level plans (1 vCPU/1GB RAM) start at $38/year, while standard plans (2 vCPU/4GB RAM/5Mbps CN2) are priced at $29.36/month, with renewal rates remaining the same. For businesses requiring fine-grained rule tuning at the WAF layer, a stable network foundation is just as vital as a controllable protection strategy—security and network quality are never mutually exclusive choices.

Relevant contents

Dynamic DNS Resolution to Handle IP Changes: Keep Your Domain Accessible Without Changing Servers A Summary of Practical Methods for Smooth Jellyfin Playback: A Comprehensive Guide Covering Transcoding, Hardware Acceleration, and Network Optimization Deconstructing the Technical Architecture of Anti-DDoS CDN: Four-Layer Synergy of Global Scheduling, Edge Access, Distributed Scrubbing, and Origin-Pull Control. How to Choose a Hong Kong VPS with Unlimited Data: A 2026 Guide to Avoiding Pitfalls and Making the Right Choice Claude API Multi-Turn Dialogue Context Management: How to Control Token Costs The whole process of domain name purchase and pitfall avoidance guide: own your exclusive domain name from scratch How to protect against IPv6 leaks? A detailed guide that even beginners can understand. How can terabit-level traffic scrubbing reconstruct the security defenses of Hong Kong VPS in 2026? Headquartered in Singapore, Jtti has a global presence and is committed to providing stable and reliable digital infrastructure services to multinational corporations. Hong Kong Optimized VPS vs. Japan Optimized VPS: A Comprehensive Comparison of Latency, Bandwidth, and Price
Go back

24/7/365 support.We work when you work

Support