Curriculum / WAF policies and traffic control
WAF policies
Build a Web Application Firewall policy — rule conditions, actions, and safe rollout with detection mode.
Goal
Create a WAF policy, attach it to an application, and roll it out safely without breaking legitimate traffic.
What a policy contains
A WAF policy is an ordered list of rules. Each rule combines:
- Conditions — matches on method, path, headers, query, body, client IP, geo, or reputation
- Action — allow, block, challenge, or log
- Scope — which applications or routes the rule protects
Built-in protections cover the usual suspects: SQL injection, cross-site scripting, path traversal, malformed requests, and known-bad user agents.
Safe rollout: detect first
Never turn a new policy straight to blocking on production traffic.
- Create the policy with rules in detection (log-only) mode.
- Send real traffic through it for a few days.
- Review matches in the logs; tune away false positives (usually an over-broad path or body pattern).
- Switch rules to block one group at a time.
Steps
- Open Policies in the console and create a policy for your application.
- Enable the baseline protection rule groups in detection mode.
- Attach the policy to the application route.
- After tuning, flip to blocking and publish.
Verify
- A test request with an obvious injection payload (
' OR 1=1--in a query parameter) is logged, then blocked once you enable blocking. - Normal application flows produce no matches.
Pitfalls
- Blocking APIs that legitimately send SQL-looking text (e.g. code snippets) — scope body rules to the routes that need them.
- Forgetting that policy changes need a publish to reach the proxy.