> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ankra.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Edge firewall

> Check requests to your ankra.cc and hosted-domain addresses for attacks before they reach your cluster, set the protection for the organisation, a cluster or one address, and add exceptions for requests it should let through.

> [!WARNING]
>
> **Closed beta.** The edge firewall is in closed beta. The workflow is stable but the surface may still change, and it is enabled per organisation on request. [Contact support](https://docs.ankra.ai/platform/support.md) to have it turned on for your organisation. While it is off, the firewall section and the **Firewall** row are not shown, and the CLI, API and Terraform answer that the zone has no firewall.

Requests to an address on your organisation's `ankra.cc` domain, or on a domain Ankra hosts for you, pass through Ankra's edge before they reach your cluster. The edge firewall checks each request against the OWASP Core Rule Set, which looks for SQL injection, cross-site scripting, shell commands, file path tricks and other common attacks, and can refuse one with `403` before your app sees it.

Only addresses served through Ankra's edge are checked. A DNS record that points straight at your own server, without the Ankra proxy, does not pass through the firewall. See [Use your own domain](https://docs.ankra.ai/guides/use-your-own-domain.md) for how a domain is hosted, and [Private access for proxied domains](https://docs.ankra.ai/guides/private-proxied-domains.md) to also require sign-in in front of an address.

## How the protection is chosen

The firewall can be set at three levels, and the most specific setting wins for each address:

| Level | Applies to | Where you set it |
| - | - | - |
| Address | One hostname, such as `api.<cluster-zone>` | The application's **Is it safe?** card, or `ankra org waf hostname set` |
| Cluster | Every address in the cluster's zone without a setting of its own | **Domains**, the cluster's row |
| Organisation | Every cluster that follows the organisation, and the organisation zone itself | **Domains**, **Whole organisation** |

A cluster follows the organisation until you give it a setting of its own, and an address follows its cluster. Until anyone changes it, every address uses Ankra's default: attacks are blocked, at standard sensitivity.

Each setting has a mode and a sensitivity:

| Mode | What happens |
| - | - |
| **Blocks attacks** | Requests that look like an attack are refused with `403` before they reach your app. |
| **Only logs attacks** | Every request reaches your app. Ones that look like an attack are listed as only logged, so you can check them before you start blocking. |
| **Off** | Requests are not checked at all. |

Standard sensitivity runs the Core Rule Set's first paranoia level. Strict (**Check more strictly** in the portal) runs the second level, which catches more attacks and also refuses more ordinary requests by mistake.

Changes reach the edge within a few seconds.

## Set the protection in the portal

1. Open **Infrastructure** → **Domains**. The **Edge firewall** section lists **Whole organisation** and each cluster, with the protection each one has now.
2. Choose **Change** on the row you want to set. Members whose role cannot change the firewall see **Look** instead.
3. Under **How requests are checked**, pick **Blocks attacks**, **Only logs attacks** or **Off**. For a cluster, **The same as the whole organisation** makes it follow the organisation again.
4. Tick **Check more strictly** if you want strict sensitivity, then save.

The dialog also lists **Addresses with their own setting**: those win over the setting you just changed.

To set the firewall for one application's address, open the application and look at the **Is it safe?** card on its overview. The **Firewall** row says how requests to the address are checked, whether that is its own setting, its cluster's or the organisation's, and how many requests were blocked in the last week. **Manage** opens the same choices for that one address, with **The same as its cluster** first. An address on a domain Ankra does not host says it has no Ankra firewall.

Reading the firewall needs organisation membership. Changing it needs an organisation admin.

## Let blocked requests through without turning the firewall off

Some ordinary traffic looks like an attack to the Core Rule Set. A SPARQL or GraphQL endpoint, a search box that accepts query syntax, or an API that takes code snippets can all trip it. Turning the firewall off for the address removes every check; an exception removes only the checks that misfire, on only the path where they do.

The firewall keeps what it blocked, and in **Only logs attacks** mode what it would have blocked, for seven days. Each entry has the address, method, path, client address and the checks that matched.

1. Open the firewall for the organisation, the cluster or the address, as above. **Blocked in the last week** lists the requests.
2. Choose **Allow requests like this** on the request that should have gone through.
3. If the request's path has a parent, choose under **Which requests to let through** whether the exception starts at the request's path or at its parent.
4. Read the sentence that says what will change, then choose **Add the exception**.

The exception skips only the checks that blocked that request, on that address, for the path it starts at and every path below it: an exception at `/sparql` also covers `/sparql/query`, but not `/sparqlx` or `/admin`. Every other check stays on there, and every other address is checked as before.

> [!WARNING]
>
> An exception that starts at `/` covers every request to the address. Prefer the narrowest path that carries the traffic you want to let through.

The exceptions in effect are listed under **Exceptions**, each with where it was set, and **Remove** takes one away.

A good way to bring a new service behind the firewall is to set its address to **Only logs attacks**, use it normally for a while, turn every false alarm in **Blocked in the last week** into an exception, then switch to **Blocks attacks**.

## Manage it from the CLI

`ankra org waf` works on zones by DNS name: the organisation zone, which `ankra org dns zone` prints, or a cluster's zone, which `ankra cluster domain` prints.

```bash theme={null}
ankra org waf get <cluster-zone>
ankra org waf set <organisation-zone> --mode block --sensitivity strict
ankra org waf set <cluster-zone> --mode monitor
ankra org waf inherit <cluster-zone>
```

`get` shows the zone's own setting, or that it follows the zone above, the protection in effect and where it comes from, and every address with a setting of its own. `inherit` makes a cluster zone follow the organisation again.

One address:

```bash theme={null}
ankra org waf hostname set <cluster-zone> legacy.<cluster-zone> --mode monitor
ankra org waf hostname remove <cluster-zone> legacy.<cluster-zone>
```

### Rules and exceptions

A rule tunes the firewall without turning it off. It matches requests by `--path` (that path and everything below it), `--method` and `--source` (a client address range in CIDR notation), and applies to one `--hostname` or, without it, to every address at or below the zone. A rule set at the organisation zone reaches every cluster zone.

| `--action` | What a matching request gets |
| - | - |
| `skip_rules` | Checked as usual, except for the Core Rule Set rules in `--rule-id`. |
| `allow` | Forwarded without any check. Needs `--path`, `--method` or `--source`. |
| `block` | Refused with `403`, whatever the mode, including **Off**. Needs `--path`, `--method` or `--source`. |

> [!WARNING]
>
> An `allow` rule switches every check off for the requests it matches. One that matches only by `--source` or `--method`, set at the organisation zone, does that for every cluster. Prefer a `skip_rules` exception for the checks that misfire, and give an `allow` rule the narrowest `--hostname`, `--path` and `--source` that carry the traffic.

A matching `block` wins over everything, then a matching `allow`. The skipped rules of every matching `skip_rules` rule add up, so the order of rules does not matter. A zone holds up to 200 rules, and `--disabled` stores a rule without applying it.

`events` shows what was blocked and the rule ids each request tripped. Those ids go into a `skip_rules` exception as they are:

```bash theme={null}
ankra org waf events <cluster-zone> --hostname api.<cluster-zone>

ankra org waf rules add <cluster-zone> --action skip_rules \
  --hostname api.<cluster-zone> --path /sparql \
  --rule-id 920420 --rule-id 942100 --rule-id 942151 \
  --description "SPARQL queries read as SQL injection"

ankra org waf rules add <organisation-zone> --action block --path /wp-admin \
  --description "Nothing here runs WordPress"

ankra org waf rules list <cluster-zone>
ankra org waf rules delete <cluster-zone> <rule-id>
```

`rules list` shows the rules that apply at or below a zone, broadest zone first, with the zone each one was set at. A rule is changed or deleted at the zone it was set at.

## Terraform, the API and Ankra's AI

The same settings are available everywhere the platform is:

* **Terraform**: the [Ankra provider](https://docs.ankra.ai/integrations/terraform.md) has `ankra_organisation_dns_zone_waf` for a zone's setting, `ankra_organisation_dns_zone_waf_hostname` for one address, `ankra_organisation_dns_zone_waf_rule` for a rule or exception, and the `ankra_organisation_dns_zone_waf` data source. They ship in the provider release after v0.5.0.
* **API**: the organisation DNS routes under `/api/v1/org/dns/zones/{zone}/waf` in the API Reference. As everywhere else, reading needs organisation membership and changing needs an organisation admin.
* **Ankra's AI and the MCP server**: the AI Assistant can show the firewall, what it blocked and the exceptions, and an organisation admin can ask it to change them. Try "What did the firewall block on my production cluster this week?" or "Requests to /sparql on api.my-cluster are being blocked, let them through without turning the firewall off."

## Troubleshooting

**An address has no Firewall row, or the CLI says the zone is not hosted.** The edge firewall may not be on for your organisation yet (see the note at the top). Otherwise the address is on a domain Ankra does not host, or its DNS record does not go through the Ankra proxy. Only proxied addresses on `ankra.cc` or a hosted domain are checked.

**A setting does not take effect on an address.** A more specific setting wins. Check **Addresses with their own setting** on the cluster or organisation, or run `ankra org waf get` on the cluster zone, which shows where the protection in effect comes from.

**A request is still refused after adding an exception.** A `block` rule refuses a request whatever exceptions match it. Run `ankra org waf rules list` on the zone and look for a `block` rule whose path, method or source matches. A request can also trip a different check than the one you skipped: look at its newest entry with `ankra org waf events` and add that rule id.

**You cannot change the firewall.** Changes need an organisation admin. Other members see the settings and the blocked requests, with **Look** instead of **Change**.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.