This guide will describe how to configure your Cloudflare security rules. You will first need to sign into your Cloudflare account, navigate to the Security page on the left, then select Security Rules. Here you will create the new Security Rules.
Set the title of the first rule to: “Allow BetterStack and StatusCake and LetsEncrypt”
Copy and paste this into the expression field:
(http.user_agent contains "BetterStackStack") or (http.user_agent contains "StatusCake") or (http.request.uri contains "/.well-known/acme-challenge/") or (http.user_agent contains "Ads") or (cf.client.bot) or (cf.verified_bot_category eq "Advertising & Marketing") or (ip.src.asnum eq 15169)Set the action to: Skip
Assign the following WAF components to skip:
All remaining custom rules
All rate limiting rules
All managed rules
All Super Bot Fight Mode Rules
2. Set the title of the second rule to: “High security for contact-us”
Copy and paste this into the expression field: http.request.uri.path contains "contact-us"
Set the action to: Managed Challenge
Place at last (we will set the next rule to last, after that we will come back to this rule and place it after the first rule)
3. Set the title of the third rule to: “Block all outside US and Canada except BOT”
Copy and paste this into the expression field: (ip.geoip.country ne "US" and ip.geoip.country ne "CA") and not cf.client.bot
Set the action to: Block
Place at last
