How to Protect Your Public AppGini App from Bots, Brute-Force Logins, and Scrapers with Cloudflare
If your AppGini app is reachable from the public internet, it’s already being probed. Not by curious humans, but by bots: scripts that hammer your login page with password lists, scrapers that crawl every detail view to vacuum up your data, and vulnerability scanners that poke at your URLs looking for anything unpatched. None of this shows up as a dramatic hack. It shows up as a slowly climbing server load, a login page that mysteriously locks out real users, and, if you’re unlucky, a support ticket from a customer whose data turned up somewhere it shouldn’t have.
The good news: you don’t have to fix this in PHP. Cloudflare sits in front of your app and can filter out almost all of this traffic before it ever reaches your server, and the free plan covers a surprising amount of it. This post walks through a practical setup for AppGini apps specifically, built around one idea that makes the whole thing much easier to reason about: GET requests and POST requests deserve different treatment.
We’ve previously covered how to protect an anonymous detail view against automated bot submissions using Cloudflare’s automatic bot detection. This post goes further: it’s the fuller playbook for locking down an AppGini app end to end against brute-force login attempts, scraping, and vulnerability scanning, using rate limiting, managed rulesets, and custom WAF rules layered on top of each other.
Why GET vs. POST is the right way to think about this
AppGini generates typical PHP CRUD apps. Almost every GET request is someone (or something) looking at data: a list view, a detail view, a search, an export link. These need to stay fast and mostly open, because search engines, previews, and legitimate anonymous users rely on them.
Almost every POST request is someone doing something that should require authorization: logging in, submitting a form, updating a record, deleting a row, uploading a file. These are the requests that matter most from a security standpoint, because a successful bot attack against a POST endpoint (like login) has real consequences: account takeover, spam data, or resource exhaustion.
That split gives you a simple rule of thumb for every protection layer below: be generous with GET, be strict with POST, especially POST requests to index.php (which handles AppGini’s login form) and to the admin/ scripts that handle authenticated CRUD actions.
What you’ll set up
By the end of this post your app will have four layers of defense, each catching what the others miss:
- Cloudflare in front of your domain, the prerequisite for everything else.
- A managed ruleset that blocks known exploit patterns and vulnerability-scanner signatures automatically.
- Bot Fight Mode, which challenges traffic that behaves like a script instead of a browser.
- A rate limit on your login POST requests, the specific fix for brute-force login attempts.
- (Optional, advanced) A custom WAF rule and Turnstile, for tighter control over exactly which POST requests are allowed through.
Prerequisites
- A domain you control, with access to update its nameservers (or you’re already on Cloudflare).
- Your AppGini app deployed and reachable at that domain.
- A free Cloudflare account. Everything in this post works on the Free plan; a couple of optional steps are called out where a paid plan gives you more knobs.
If you haven’t put your site behind Cloudflare yet, do that first: add your site, let Cloudflare import your existing DNS records, update your domain’s nameservers to the ones Cloudflare gives you, and make sure the DNS record for your app is proxied (the cloud icon next to it should be orange, not grey). Traffic only gets filtered by the rules below when the record is proxied.

Step 1: Turn on a managed ruleset to catch vulnerability scanners
Vulnerability scanners send a flood of requests trying known exploit paths, such as /wp-login.php, /.env, /phpmyadmin, SQL injection strings in query parameters, and path traversal attempts. Your AppGini app doesn’t have those endpoints, but the scanner doesn’t know that until it’s already sent thousands of requests. Cloudflare’s managed rulesets block this traffic using signatures maintained by Cloudflare’s own security team, and they update automatically, so you don’t maintain a thing.
- In the Cloudflare dashboard, go to Security > Settings for your zone.
- Turn on the Cloudflare Managed Ruleset.
- Turn on the OWASP Core Ruleset as well; it adds broader coverage for common web-app attack patterns (SQL injection, XSS, and similar).
- For finer control (which rule groups are active, sensitivity level, and per-rule overrides), go to Security > Security rules, find the ruleset, and open it.
This step alone stops the majority of automated scanning noise, and it applies to both GET and POST requests without you writing a single rule.

Step 2: Turn on Bot Fight Mode
This is the broadest, lowest-effort layer, and it’s available on every plan including Free.
- Go to Security > Settings, filter by Bot traffic.
- Turn on Bot Fight Mode.
Cloudflare fingerprints requests using signals a script can’t easily fake, such as TLS handshake quirks, missing browser headers, and request timing, and issues a computationally expensive challenge to anything that looks automated. Real browsers solve it invisibly; scripts and headless scrapers generally don’t.
If you’re on a paid plan, you’ll see Super Bot Fight Mode instead, which adds separate controls for “definitely automated,” “likely automated,” and verified bots (like search engine crawlers, which you’ll want to keep allowing so your app stays indexed).
One thing worth knowing: Bot Fight Mode runs outside the normal rules engine, so you can’t selectively exempt a specific URL from it with a custom rule. If it ever misfires on a legitimate integration (a webhook, an API client you built yourself), Super Bot Fight Mode’s granular settings, or a Skip rule in Step 4, give you a way out.

Step 3: Rate-limit login attempts, the fix for brute force
This is the step that most directly answers “someone is trying to brute-force my login.” Bot Fight Mode and managed rulesets catch a lot, but a slow, patient credential-stuffing script that mimics a browser can slip past them. A rate limit on login requests catches it regardless of how convincing the bot looks, because it’s just counting requests.
AppGini’s login form posts back to index.php, the app’s front controller, rather than to a separate login.php script. Unauthenticated visitors reach it mainly to view public pages (GET) or to log in (POST), so a rate limit scoped to POST requests on that path catches login attempts without affecting authenticated users working in the admin/ area.
- Go to Security > Security rules.
- Select Create rule > Rate limiting rules.
- Give it a name, e.g.
Login brute-force protection. - Under When incoming requests match, set the expression to target login attempts specifically:
(http.request.uri.path eq "/index.php" and http.request.method eq "POST") - Under With the same characteristics, choose IP address (or IP with NAT support if a lot of your users are behind a shared office or campus IP and you want to avoid blocking a whole office over one bad actor).
- Under When rate exceeds, set something like 5 requests per 60 seconds. A real user mistyping a password a few times won’t hit that; a brute-force script will.
- Set Then take action to Managed Challenge (lets a human through after solving a lightweight challenge) or Block (a harder cutoff). Managed Challenge is the friendlier default.
- Set the mitigation timeout; 5 to 10 minutes is reasonable for a first pass.
- Deploy.
Because the expression only matches POST requests to index.php, this rule has no effect on anyone just browsing your app’s public views, exactly the GET/POST split described earlier.

Step 4 (optional, advanced): Lock down authenticated POST actions with a custom WAF rule
If you want an extra layer around the actions that only logged-in users should reach, such as admin/addrec.php, admin/editrec.php, admin/deleterec.php, and similar scripts in AppGini’s admin/ folder, you can write a custom rule that treats POST traffic to that area more suspiciously, while leaving every GET request and your public login page alone.
- Go to Security > Security rules > Create rule > Custom rules.
- Name it, e.g.
Challenge admin POST actions. - Build an expression such as:
Combine it with any additional signal you have, for example excluding your own office or VPN IP range with(http.request.method eq "POST" and starts_with(http.request.uri.path, "/admin/"))not ip.src in {203.0.113.0/24}so your team’s own traffic isn’t challenged. - Set the action to Managed Challenge for a balance of security and usability, or Block if you’re comfortable being strict. On plans that support it, test with Log first so you can see what would have matched before you commit to blocking.
- Deploy, then check Security > Events over the next day to confirm it’s catching what you expect and not your own legitimate traffic.
Treat this step as advanced and test it carefully. An overly broad POST rule can block legitimate actions from real logged-in users, so start with Log or Managed Challenge, not Block, until you’ve watched it run for a while.

Step 5 (optional): Add Turnstile to your login form directly
Everything above works at the network edge without touching your app’s code. If you want an extra, more visible layer specifically on the login form, Cloudflare’s Turnstile is a free CAPTCHA alternative that runs invisibly in the background for most visitors and only shows an interactive check to traffic that looks automated.
- Create a Turnstile widget in the Cloudflare dashboard under Turnstile, and choose the Managed widget type (it decides on its own when to show a challenge).
- Add the widget’s site key to your AppGini login page template: a small
<div>plus a script tag, per Cloudflare’s snippet. - On your server, validate the token AppGini’s login handler receives against Cloudflare’s Siteverify API before processing the login, and reject the request if verification fails.
This is more work than the edge-only steps above since it touches your login page’s HTML and PHP, so treat it as an enhancement once the Cloudflare-side rules are in place, not a replacement for them.

Testing your rules
Before you trust any of this, generate some traffic and watch what happens:
- Log in normally a couple of times from your own browser. You shouldn’t notice anything different.
- Check Security > Events in the dashboard to see which rules are firing, on what paths, and for which actions. This is also where you’ll spot a rule that’s too aggressive before it annoys a real customer.
- If you have a way to script a handful of rapid login attempts from a test environment (never against production credentials), confirm the rate limit actually kicks in around the threshold you set.
Troubleshooting
A legitimate user got challenged or blocked. Check Security Events for the matching rule, and consider loosening the threshold (Step 3) or narrowing the expression (Step 4). If it’s someone on a shared office IP, switch the rate limit’s characteristic to IP with NAT support.
Bot Fight Mode is interfering with an API client or webhook you built. You can’t exempt it via a custom rule directly. Either upgrade to Super Bot Fight Mode for granular controls, or make sure that client identifies itself in a way Cloudflare recognizes as a verified bot.
Search engines stopped indexing your public pages. Double-check your rules only match POST, not GET. This is the single most common self-inflicted mistake in this kind of setup, and it’s exactly why the GET/POST split matters so much for AppGini apps specifically, where public list and detail views are meant to stay open.
Wrapping up
None of these four layers needs to be perfect on its own; that’s the point of stacking them. The managed ruleset catches the scanners, Bot Fight Mode catches the scripts, the rate limit catches the patient brute-force attempts that slip past both, and the custom rule (if you need it) gives you a scalpel for anything else. All of it runs in front of your AppGini app without a single change to the app itself, and all of it is available on Cloudflare’s free plan.
If you haven’t already, it’s worth combining this with the automatic bot detection covered in our post on protecting anonymous detail views; together they cover both the public-facing and the authenticated sides of your app.
About BigProf Software
BigProf Software is the maker of AppGini, a tool for building database-driven web applications quickly, without writing boilerplate CRUD code by hand. Generated apps are plain PHP and MySQL, so they run on almost any standard hosting environment and stay fully editable.