# Block List

> Block matching requests in Cloak Proxy with a 403 Forbidden response or by dropping the connection, to test failures or silence noisy endpoints.

Source: https://docs.subcloak.com/cloak-proxy/tools/block-list/

The Block List stops matching requests before they reach the server. Cloak Proxy either answers with `403 Forbidden` or closes the connection as if the network failed. Use it to see how your app copes when one endpoint is down, or to keep analytics and ad requests out of a test.

## Block a request

1. Right-click a request in the traffic list and choose **Tools › Block List…**.

   Cloak Proxy creates a rule that matches the request's URL (without its query) for any method, with subpaths on, turns the Block List on and opens the rule. To start from scratch, choose **Tools › Edit Block List Rules…** (<kbd>⌥</kbd> <kbd>⌘</kbd> <kbd>K</kbd>) and click **+**.

2. Adjust the matcher if needed. To block a whole host, use something like `analytics.example.com/`.

3. Under **Action**, choose **Return 403 Forbidden** or **Drop the connection**.

4. Make the request again. It shows a `Block List` badge in the traffic list.

*[Screenshot: A Block List rule matching any method on https://api.example.com/v1/users with subpaths, and the Action section with Return 403 Forbidden selected. A Block List rule. The note under the actions says what the app will see.]*

## Actions

| Action | What the app sees | In the traffic list |
|---|---|---|
| **Return 403 Forbidden** (default) | A `403 Forbidden` response with `Content-Type: text/plain; charset=utf-8`, the header `X-Cloak-Proxy: blocked`, and the body `Blocked by Cloak Proxy rule “<rule name>”`. | A completed request with status 403. |
| **Drop the connection** | The connection closes without a response, as if the network failed. | A failed request with the message `Blocked by “<rule name>”`. |

Pick **Return 403 Forbidden** to test how your app shows a server refusal, and **Drop the connection** to test its offline and retry handling.

## How blocking works with other tools

- The Block List runs first. A blocked request never reaches scripts, breakpoints, Map Local, Mock Sets, Map Remote, Network Conditions or the server.
- Only the first matching rule is used.
- Blocked requests are still recorded (unless the [Allow List](https://docs.subcloak.com/cloak-proxy/tools/allow-list/) hides them) and still trigger [Alerts](https://docs.subcloak.com/cloak-proxy/tools/alerts/), so a **Server error (5xx)** alert won't fire on a 403, but **Any error** will.

> **HTTPS hosts need SSL Proxying:**
> The Block List checks the full URL, so it only sees HTTPS requests to hosts or apps with [SSL Proxying](https://docs.subcloak.com/cloak-proxy/capture/ssl-proxying/) on. Encrypted tunnels that Cloak Proxy doesn't decrypt pass through unblocked. Turn on SSL Proxying for a host before you block it.

> **Caution:**
> Blocking a host your app depends on, such as its login or configuration server, can make the app look broken in ways that are hard to trace later. Name rules clearly and turn the Block List off when you finish testing.

## Related

  - [Network Conditions](https://docs.subcloak.com/cloak-proxy/tools/network-conditions/): Drop a share of requests at random, or slow them down.
  - [Allow List](https://docs.subcloak.com/cloak-proxy/tools/allow-list/): Record only the requests you care about.
  - [Rules and matching](https://docs.subcloak.com/cloak-proxy/tools/rules-and-matching/): Patterns, subpaths and the order tools run in.
  - [Breakpoint](https://docs.subcloak.com/cloak-proxy/tools/breakpoint/): Abort one request by hand instead of blocking every match.
