# Cloudflare Firewall Configuration

The following documentation provides detailed instructions on how to configure a custom rule in the Cloudflare firewall to ensure the proper functioning of an API when the 'Under Attack' mode is active. This is particularly useful to allow the desired traffic to pass through without compromising the security of the site.

## Steps

1\) Login to clouflare

2\) Choose the domain on which you want to perform this operation

3\) Go to rules > Configuration Rules

<figure><img src="https://1245271457-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpAVLxqF68yyMO0LSqQrz%2Fuploads%2FJ6TMOUV8ocrt1dj7qzO7%2Fimage.png?alt=media&#x26;token=07b19ebd-d61f-4a67-bd25-ad5edc18b782" alt=""><figcaption></figcaption></figure>

4\) Create new rule

5\) We enter a name for the rule in this case 'API Rule' is recommended

6\) Configuring the condition, In the 'If' section, add a condition that matches the API URL. Let us put, URL Path, then as operator we enter contains and then as value we enter '/api/v1'. \
\
Eventually we should have this:

<figure><img src="https://1245271457-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpAVLxqF68yyMO0LSqQrz%2Fuploads%2FE2NFS7UmAfgQnvSdsasf%2Fimage.png?alt=media&#x26;token=3f661a21-3d37-44d7-bcb4-94c2fd8bb878" alt=""><figcaption></figcaption></figure>

7\) Under "Then the settings are…", let's go for "Security level" and let us add. Under "select security level" let's set 'essentially off

<figure><img src="https://1245271457-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpAVLxqF68yyMO0LSqQrz%2Fuploads%2F2xmKLluT1wwHutvHduyI%2Fimage.png?alt=media&#x26;token=3accd95b-7373-4804-a72a-e381a391f569" alt=""><figcaption></figcaption></figure>

8\) Now we press on deploy and that's it.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.spectrasolve.net/general/cloudflare-firewall-configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
