Every unprotected WordPress website is scanned by automated bots often within minutes of going live, probing targets like wp-login.php or xmlrpc.php. A WordPress firewall (Web Application Firewall, or WAF) filters incoming requests to your site and blocks known attacks before they do any damage. There are three types: plugin firewall (runs directly inside WordPress), cloud firewall (runs as a reverse proxy in front of your server, routed via DNS) and server firewall (runs at the host). For most websites a cloud firewall or a well-configured plugin firewall is the best start.
A firewall is like a bouncer for your website. It checks everyone who wants in and only lets through those who behave normally. Anyone who wants to inject malicious code, knocks suspiciously often or comes from a known botnet address stays outside. In a time when bots test thousands of sites for vulnerabilities every day, that is one of the most effective layers of protection.
In this article you will learn what a WordPress firewall does exactly, which types there are, how they differ, how to set one up and which mistakes to avoid. You will find an overall overview of all protective measures in the WordPress security checklist.
What is a web application firewall (WAF)?
A classic network firewall looks at IP addresses and ports. A web application firewall, WAF for short, works one level higher: it understands web requests and checks their content. It recognizes, for example, when someone injects SQL commands into a form field or tries to read files from other folders via the URL.
What a WAF blocks
- SQL injection: Attempts to read or change the database via manipulated input.
- Cross-site scripting (XSS): Injected scripts that run in the browser of other visitors.
- File injection and path manipulation: Access to files that should not be public.
- Brute force attacks: Mass login attempts (more in the article Detecting and stopping brute force attacks).
- Malicious bots and scanners: Programs that look for vulnerabilities.
- Known exploits: Attacks on published plugin and theme vulnerabilities.
What a WAF does not do
A firewall is no excuse to skip updates. It catches many attacks, but not all. Against stolen credentials (for example via phishing), authorization logic flaws in a plugin or malicious code already sitting on the server, it offers only limited protection. Therefore, treat it as one layer in a broader security concept alongside regular updates, strong login protection (including two-factor authentication), backups and monitoring.
The three types of firewalls at a glance
| Feature | Plugin firewall | Cloud firewall | Server firewall |
|---|---|---|---|
| Where does it run? | In WordPress on your server | In front of your server, via DNS or proxy | At server level at the host |
| When does it act? | After the request reaches WordPress | Before the request reaches your server | Before WordPress, after the network |
| Server load | Loads the server | Relieves the server | Low |
| Setup | Simple, via plugin | DNS change needed | At the host or admin |
| Typical costs | free to annual license | free to monthly | often included in hosting |
| Strength | Knows WordPress exactly | Also catches DDoS and bot floods | Blocks ports and networks |
| Weakness | Acts late, can be bypassed if PHP is compromised | Privacy and forwarding to consider | Usually does not know WordPress logic |
Plugin firewall: protection directly in WordPress
A plugin firewall like the ones from Wordfence or Solid Security is installed in WordPress. It checks requests after they arrive on your server—and in optimized mode (via PHP auto_prepend_file), even before WordPress loads its own core code.
Advantages
- Simple installation, no DNS change needed
- Knows WordPress, plugins and themes and matches rules with current vulnerabilities
- Combines firewall, malware scan, login protection and notifications
- Easy start for beginners too, often usable in the free basic version
Disadvantages
- Runs inside PHP on your server and consumes CPU and memory resources there
- During massive bot floods your web server and PHP workers are still strained because every request hits your server first
- Free versions often get new rules with a delay
- If PHP itself is compromised, the protection can be bypassed
Who is it suitable for?
For small and medium sites, blogs and company websites that need solid basic protection quickly. It is the simplest way to activate protection.
Cloud firewall: protection in front of your server
With a cloud firewall (for example Cloudflare, Sucuri or Bunny Shield) you route your traffic through the provider's global network. To do this, you either switch your domain's nameservers (typical for Cloudflare) or update the A or CNAME record in your DNS (typical for Sucuri). All requests first pass through the provider's edge servers, which filter out harmful traffic using rules and IP reputation. Only clean requests reach your actual web server.
Advantages
- Relieves the server because attacks do not even arrive
- Also protects against DDoS and massive bot waves
- Often speeds up the site additionally through caching and CDN
- Rules are updated centrally
Disadvantages
- Setup is more technical, wrong DNS settings can take the site down
- Traffic runs through a third party, so verify GDPR compliance and a Data Processing Agreement (DPA)
- Some functions are paid
- You depend on one more service
Who is it suitable for?
For sites with higher traffic, shops and everyone who regularly sees attacks. The combination of protection and performance makes it particularly attractive. You will also find more about the cloud variant in our article on the Cloud firewall.
Server firewall: protection at the host
The server firewall runs on the server itself, usually as part of the hosting package. It blocks unneeded ports, blocks suspicious networks and with modules like ModSecurity can also filter web requests.
- Advantage: Acts early without you having to install anything. Often included in the price.
- Disadvantage: Does not always know WordPress-specific patterns. Rules can produce false alarms, and with shared hosting you often have no influence on the configuration.
- Tip: Ask your host which protection functions are active. You will find more on hosting on the page Server and hosting.
Which firewall suits you?
- Small site, little effort desired: plugin firewall with login protection.
- Site with a shop, many visits or frequent attacks: cloud firewall, complemented by the host server firewall.
- Own server or VPS: configure the server firewall yourself, plus cloud or plugin protection.
- Highest requirements: combination of all three layers (defense in depth).
The rule of thumb: the earlier the attack is caught, the better for server load and security. The cloud firewall is furthest in front, the plugin firewall closest to WordPress. Ideally they complement each other.
Setting up a firewall: step by step
Plugin firewall
- Create a backup, see Create a WordPress backup.
- Install the plugin of your choice and activate the firewall.
- Start in learning mode if available so normal visitors are not blocked.
- After one to two weeks activate full protection.
- Set up email notifications.
- Enter your own IP address in the exception list.
- Test contact form, login and if applicable shop to see if everything works.
Cloud firewall
- Create an account with the provider and add your domain.
- Carefully check the automatically imported DNS entries, especially for email (MX, SPF, DKIM).
- Change the nameservers at your domain registrar to those of the service (or set the specified A or CNAME record, depending on the provider).
- Enable HTTPS in "Full (strict)" mode as soon as a valid certificate is on the server.
- Enable the WAF rules and bot protection.
- Restrict access to your origin server via IP allowlisting or Authenticated Origin Pulls exclusively to the firewall service so nobody can bypass the WAF via your direct server IP.
- Watch the events in the first days and adjust rules in case of false alarms.
Server firewall
- Ask your host which rules and modules are active.
- Close all ports that are not needed, for example direct database access from outside.
- Allow SSH only for certain IP addresses or only via key.
- Enable protection modules like ModSecurity with current rule sets if available.
Firewall rules you should know
Firewalls work with rules. Even if the default settings fit most sites, it helps to understand the most important rule types:
- Signature-based rules: They recognize known attack patterns, such as typical SQL fragments in URLs or forms. They are the core of every WAF.
- Reputation-based rules: IP addresses with a bad reputation (botnets, known scanners) are blocked automatically.
- Rate limiting: Anyone who sends too many requests in a short time is slowed down or temporarily blocked. This effectively helps against brute-force attacks and content scraping.
- Geo rules: Access from certain countries is blocked or checked additionally, for example for the login area.
- Behavior rules: The firewall recognizes bots by atypical behavior, such as requests without browser characteristics.
- Custom rules: You can, for example, release
wp-login.phponly to certain IPs or block access toxmlrpc.phpcompletely.
Useful rules for WordPress
- Additionally check access to
/wp-adminandwp-login.php(rate limiting, bot check). xmlrpc.phpis to be blocked if it is not needed.- Direct access to PHP files in
wp-content/uploadsis to be blocked. - Requests with suspicious strings in the URL (for example
../,union select) are rejected. - Restrict user enumeration via the REST API (/wp-json/wp/v2/users) and query parameters like /?author=1.
- Allowlist payment providers and webhooks that your system relies on.
False alarms: when the firewall blocks real visitors
An overly strict firewall sometimes blocks legitimate requests. That typically happens with contact forms with long texts, with payment providers that send responses, with the page builder in the backend or with plugins that send unusual requests.
How to proceed
- Check the log: When was what blocked, and which rule triggered?
- Recognize the pattern: Does it affect a certain page, a plugin or an IP group?
- Release specifically: Allow the concrete request or URL, not the whole rule across the board.
- Test: Repeat the action that was blocked before.
- Document: Note the exception so it stays traceable later.
Do not switch the firewall off completely just because a single rule causes issues. Targeted exceptions are always the better approach.
Firewall for online shops
With WooCommerce and other shops the requirements are higher, because payments and customer data are involved.
- Release payment webhooks: Services like PayPal or Stripe send callbacks. If the firewall blocks them, orders stay in the "payment pending" status.
- Protect checkout and cart: Rate limiting against card testing, where bots try stolen card data with tiny amounts.
- Use bot protection: Against price scraping, fake orders and fake registrations.
- Observe cache exceptions: Cart, checkout and account must not be cached, not even by the cloud firewall.
- Check logs: Recognize suspicious patterns in orders early.
Checklist: check the firewall
| Question | Yes / No |
|---|---|
| Is a firewall active and up to date? | ☐ |
| Does the traffic really run through the service (with cloud solutions)? | ☐ |
| Is the server directly reachable although it should not be? | ☐ |
| Are there notifications for attacks? | ☐ |
| Are payment providers and services released? | ☐ |
| Were the logs reviewed in the last 30 days? | ☐ |
| Is the privacy policy up to date? | ☐ |
| Was the load time measured after setup? | ☐ |
Typical mistakes with firewalls
- Rules too strict without a test phase: Real visitors, payment providers or forms are blocked.
- Firewall without updates: Outdated rules do not recognize new attacks.
- Server not restricted: With a cloud firewall the server stays directly reachable. Attackers bypass the firewall if they know the real server IP.
- Ignoring false alarms: Then rules get switched off entirely at some point.
- Relying only on the firewall: Without updates, backups and login protection a residual risk remains.
- Not checking logs: You do not see what is blocked and whether something changes.
Firewall and performance
A good firewall can make your site faster. A cloud firewall keeps bot traffic away before it burdens your server and often serves static content directly from the cache. A plugin firewall, on the other hand, costs some computing time, which you keep low with lean configuration (real-time scans only where needed). Measure the load time after setup so you see the effects.
Firewall and data protection
Firewall services process IP addresses and access logs, which qualify as personal data under GDPR. Check where the provider processes data, ensure a Data Processing Agreement (DPA under Art. 28 GDPR) is in place and update your privacy policy accordingly (typically based on legitimate interest under Art. 6(1)(f) GDPR). Many providers offer EU locations or corresponding contracts. Clean documentation also helps you with questions from customers or authorities.
What to do if an attack gets through?
No firewall is perfect. If something happens anyway, a clear plan helps you. How to recognize and rescue an infected site is described in the articles WordPress hacked and Remove WordPress malware. And if a known vulnerability was the entry point, this article helps: WordPress vulnerabilities: detect, close, prevent.
Firewall at Boudmedia
We set up firewall and monitoring for you and keep everything up to date. The Security package costs $32 per month. If you also want to hand over updates and backups, combine it with Wartung for $99 per month and Backups for $16 per month. In an emergency the Emergency Recovery Service helps for $539.
Maintaining firewall rules: how to keep your protection up to date
A firewall is not a project you set up once and then forget. Attackers keep changing their methods, and your website changes as well. New plugins, new forms and new interfaces bring new attack surfaces. That is why a fixed rhythm for maintaining your rules is worth it.
Check the firewall log once a month. Look out for conspicuous clusters: many blocked requests from the same IP address or to the same URL point to targeted attacks. You can block such patterns permanently with a custom rule.
Also update your firewall rule sets. With most plugins and cloud services this happens automatically, but some settings you have to confirm yourself. So after every major update, check that all protection features are still active.
A simple routine helps you with this:
- Review the log for anything unusual
- Keep rule sets and the plugin version up to date
- Review exceptions and remove those you no longer need
- Run a test after adding new plugins or forms
This way you spot problems early, before they turn into real outages or security incidents. If you do not have the time, we take care of ongoing maintenance as part of our maintenance plan.
Key terms around firewalls
DDoS
An attack in which thousands of devices send requests at the same time to overload a site. Cloud firewalls catch such waves at the edge.
ModSecurity
A widespread firewall module for web servers that works with rule sets and checks requests for attack patterns.
Reverse proxy
A service that sits between visitor and server and accepts requests on its behalf. Cloud firewalls work on this principle.
SQL injection
Injecting database commands via input fields or URLs. A WAF recognizes typical patterns and blocks them.
Whitelist and blacklist
The whitelist (now commonly called allowlist) permits explicitly approved addresses or rules, while the blacklist (blocklist) blocks explicitly named ones. Both are core firewall tools.
False positive
A false alarm: the firewall blocks a request that was actually harmless.
The key points in brief
- A WAF filters attacks before they do damage.
- Plugin, cloud and server protect on different levels.
- Cloud firewalls relieve the server the most.
- A test phase and exceptions prevent false alarms.
- A firewall does not replace updates and backups.
Combine several layers for the best protection.
Conclusion
A WordPress firewall catches attacks before they do damage and also relieves your server. The right choice depends on your website and requirements: a plugin firewall for a quick start, a cloud firewall for maximum protection and performance, and a server firewall as a solid baseline at your host. Combined with updates, login protection and backups, a stable security concept emerges. If you would like help with choice and setup, get in touch via the Contact page or have a look at our page on Security for details.
Frequently asked questions about the WordPress firewall
Do I need a firewall for WordPress?
For almost every site yes. It catches many attacks that would otherwise get through to your installation and is a simple, effective layer.
What is better: plugin or cloud firewall?
That depends on the need. Plugins are easier to set up, cloud firewalls relieve the server and also protect against bot floods. Many use both.
Does a firewall make my site slower?
A plugin firewall uses a small amount of computing time, while a cloud firewall often makes your site noticeably faster through caching and CDN delivery. Measure your load time before and after setup.
Is my host firewall enough?
It is a good start but does not always know WordPress-specific attacks. An additional layer makes sense.
Can a firewall block real visitors?
Yes, with false alarms. That is why a test phase, exception lists and logs are important.
Does the firewall replace updates?
No. It can catch attacks on known vulnerabilities until the update is applied, but it does not replace it.
What is virtual patching?
The firewall specifically blocks the attack on a known vulnerability before the plugin update is available or applied. That buys you time.
How do I know whether the firewall works?
In the log you see blocked requests and their reasons. If nothing shows up there, check whether it is active and whether the traffic really runs through.
Which firewall do you recommend?
For beginners a proven plugin firewall, for shops and heavily visited sites a cloud firewall. We are happy to advise you to fit your site.
What does a firewall cost?
Plugins and cloud services offer free tiers with basic features; premium plans such as Wordfence Premium or Cloudflare Pro typically range from $10 to $25 per month. With us, firewall protection is included in the Security package for $32 per month.
How can I tell if someone is bypassing my cloud firewall?
Test (for example via a curl request directly to your server IP) whether your website responds without passing through the cloud firewall. If so, configure your web server to only accept requests from your firewall provider's official IP ranges.
Do I need a firewall with managed hosting too?
The host secures the server, but not your plugins and logins. A WordPress-specific layer remains sensible.