---
title: Web application firewall
related:
  - https://docs.kentico.com/documentation/developers-and-admins/security-guidelines.md
  - https://docs.kentico.com/documentation/developers-and-admins/configuration/saas-configuration/use-your-own-content-delivery-network-or-web-application-firewall.md
  - https://docs.kentico.com/documentation/developers-and-admins/deployment/deploy-to-private-cloud.md
  - https://docs.kentico.com/documentation/developers-and-admins/security-guidelines/rate-limiting.md
---

> **Documentation indexes**
> The indexes below list current page URLs with titles and descriptions. Links on this page point to the Markdown versions of the linked pages.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

A web application firewall (WAF) inspects HTTP requests before they reach your Xperience by Kentico application and blocks requests that match known attack patterns. A WAF adds a layer of defense to your project. It doesn't replace hotfixes, updates, or a secure configuration of the application.

This page applies to projects that run behind a WAF managed by you, for example in a [private cloud deployment](https://docs.kentico.com/documentation/developers-and-admins/deployment/deploy-to-private-cloud.md) or in a SaaS project with the [custom CDN add-on](https://docs.kentico.com/documentation/developers-and-admins/configuration/saas-configuration/use-your-own-content-delivery-network-or-web-application-firewall.md). Other projects in the SaaS environment are protected by the WAF of the Xperience CDN, managed by Kentico.

> **Tip:** **Key points**
>
> - Make the application reachable only through the WAF.
> - Use a managed rule set based on [OWASP](https://owasp.org/), with anomaly scoring, and start at the lowest paranoia level.
> - Run the WAF in detection mode first, and tune false positives with the narrowest possible exclusions before you start blocking.
> - Test rule changes outside production first, and re-test your WAF rules after every update of Xperience.

## Allow traffic only through the WAF

A WAF protects the application only if every request passes through the WAF. If the application is also reachable directly, for example through its hosting platform hostname or IP address, attackers can bypass the WAF.

Lock down the origin of the application, for example with:

- An IP allowlist that accepts only the egress IP ranges of your WAF.
- A [private endpoint](https://learn.microsoft.com/en-us/azure/private-link/private-endpoint-overview) or private network between the WAF and the application.
- Mutual TLS (mTLS), with a client certificate presented by your WAF and validated by the origin.

Put every domain of the project behind the WAF, including the administration domain, email service domains, and domains added later. All domains reach the same application, so a single domain without WAF rules exposes the whole application.

In SaaS projects with the custom CDN add-on, configure IP restrictions and [client certificate validation (mTLS)](https://docs.kentico.com/documentation/developers-and-admins/configuration/saas-configuration/use-your-own-content-delivery-network-or-web-application-firewall.md#client-certificate-validation) in Xperience Portal. See [Origin protection](https://docs.kentico.com/documentation/developers-and-admins/configuration/saas-configuration/use-your-own-content-delivery-network-or-web-application-firewall.md#origin-protection).

## Recommended baseline

- **Managed rule set** – Use a managed rule set based on the [OWASP Core Rule Set (CRS)](https://coreruleset.org/), which covers the [OWASP Top 10](https://owasp.org/www-project-top-ten/) risks. Use [anomaly scoring](https://coreruleset.org/docs/2-how-crs-works/2-1-anomaly_scoring/), so the WAF blocks a request based on the total score of all matched rules, not on the first match.
- **Paranoia level** – Start at [paranoia level](https://coreruleset.org/docs/2-how-crs-works/2-2-paranoia_levels/) 1. Raise the level only after your exclusions are stable, because every higher level produces more false positives.
- **DDoS protection** – Turn on the DDoS protection of your WAF provider, and set up alerts for detected attacks.
- **Rate limiting** – Limit the number of requests per IP address. Base the limit on the highest request rate of a single IP address in normal traffic, raised by a safe margin, and run the rule in log mode before you start blocking. For limits applied by the application itself, see [Rate limiting](https://docs.kentico.com/documentation/developers-and-admins/security-guidelines/rate-limiting.md).
- **Bot management** – Turn on the bot management of your WAF provider.
- **Geo and IP rules** – If your project serves only specific regions or networks, add geo or IP rules. For example, restrict access to the administration to the networks of your organization.

## Features that need tuning

Some Xperience features send requests that managed rule sets often flag as attacks, for example, requests with HTML markup, JSON structures, or uploaded files. After you turn on the WAF, test the following areas and tune the rules that block them:

- The administration interface and its API calls
- [Page Builder](https://docs.kentico.com/documentation/developers-and-admins/development/builders/page-builder.md), [Email Builder](https://docs.kentico.com/documentation/developers-and-admins/development/builders/email-builder.md), and [Form Builder](https://docs.kentico.com/documentation/developers-and-admins/development/builders/form-builder.md)
- Rich text editing and file uploads, for example, uploads of content item assets and form files
- [Content synchronization](https://docs.kentico.com/documentation/developers-and-admins/configuration/content-sync-configuration.md) between environments

If your project includes custom endpoints or integrations, test these as well.

## Roll out the WAF

Roll out the WAF in the following order: log, observe, tune false positives, test, block, and monitor.

1. Deploy the WAF in detection (log-only) mode, starting in a non-production environment, such as a development or staging environment.
2. Run complete editor workflows in the administration. For example, create and publish pages, upload media, and build forms and emails. Also test the live site, including form submissions.
3. In the WAF logs, find the requests that the WAF would block. For each [false positive](https://coreruleset.org/docs/2-how-crs-works/2-3-false-positives-and-tuning/), find the matched rule and the matched variable, such as the request path, a header, or a form field.
4. Add the narrowest possible exclusion for each false positive. See [Tune exclusions](#tune-exclusions).
5. Repeat the workflows until the logs show no more false positives.
6. Switch the WAF to prevention (blocking) mode and run the workflows again.
7. Apply the tested rules to the next environment, up to production.
8. Set up alerts for requests that the WAF flags as attacks, and review the WAF logs on a regular schedule. Base the frequency of the reviews on the traffic and the risk profile of your project.

Test every change of the WAF rules in a non-production environment before production, and re-test the workflows after every [update](https://docs.kentico.com/changelog.md) of Xperience.

## Tune exclusions

When a rule blocks a legitimate request, exclude the request from the rule in the narrowest scope possible. Prefer the scopes in the following order:

1. One rule, for one path, for one field (for example, one form field or one cookie).
2. One rule group, for one path.

Never disable a rule globally or exclude a path from the whole rule set to fix one endpoint. A global exclusion removes the protection from every endpoint of the application. Scope each exclusion to the URI of the request that triggers the rule.
