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

# Web Application Firewall

> Configure a web application firewall (WAF) in front of Curator so that it does not block legitimate requests

Many organizations place a web application firewall (WAF) in front of Curator, such as Cloudflare, Akamai, AWS WAF,
Azure Application Gateway, or ModSecurity. A WAF inspects each request and blocks the ones that look like an attack.
Some normal Curator requests look like attacks to a WAF, so the WAF blocks them until an exception is added.

This page explains how to recognize a request that the WAF blocked, which Curator requests are most often affected,
and what to ask your WAF administrators to change.

> [!NOTE]
>
> Support and troubleshooting of network appliances such as WAFs, reverse proxies, and load balancers is outside the
> scope of Curator support. Every WAF is configured differently, so the guidance on this page is generic and your
> network administrators will need to adapt it to your environment.

## Recognizing a Blocked Request

The most common symptom appears in the Curator backend. An administrator saves a page, and a popup shows the raw HTML
of an error page instead of the usual confirmation message. The popup often looks like this:

```html theme={null}
<html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
</body>
</html>
```

Curator did not produce this response. A bare `403 Forbidden` page, a page that mentions your WAF vendor, or a page
that contains a reference number or a Ray ID was returned by a network appliance before the request reached Curator.

The following signs also point to the WAF:

* The same action fails every time, for every administrator, while the rest of the backend works normally.
* The action works when you reach Curator directly on the server (for example, through `localhost` or the server's
  internal address) and fails when you use the public address.
* The failed request does not appear in the Curator web server's access log.

## Finding the Rule That Blocked the Request

Your WAF administrators need to know exactly which request was blocked and when. You can collect this information
from your browser:

1. Open your browser's developer tools and select the **Network** tab.
2. Repeat the action that fails.
3. Select the request that returned a `403` status.
4. Record the request URL, the request method, the time, and the response headers. Many WAFs add a request identifier
   to the response headers or to the error page itself.

Send this information to your WAF administrators and ask them to find the matching entry in the WAF's event log. The
log entry names the specific rule that blocked the request. The rule's identifier is what they need in order to
create a narrow exception.

## Recommended Exceptions

An exception should be as narrow as possible. We recommend that each exception match the Curator hostname, the
specific URL path, and the request method, and that it skip only the rule that blocked the request. We do not
recommend turning off the WAF for the entire `/backend` area.

The following example shows the shape of a well-scoped exception:

| Setting | Value |
| - | - |
| Hostname | `curator.example.com` |
| URL path | `/backend/interworks/portal/portalsettings` |
| Request method | `POST` |
| Action | Skip only the single rule that the WAF event log identified |

The sections below list the Curator requests that most often need an exception.

### Backend Pages That Save Code

Several backend pages let administrators save HTML, CSS, JavaScript, SQL, or PHP. A WAF often reads this content as
a code injection, cross-site scripting, or SQL injection attack. All of these pages are available only to backend
administrators who are signed in and who hold the matching permission.

| Backend page | URL path | Content that is saved |
| - | - | - |
| Portal Settings | `/backend/interworks/portal/portalsettings` | Custom PHP hooks and HTML email content |
| Themes | `/backend/interworks/portal/theme/*` | Custom CSS, and custom HTML or JavaScript |
| Pages | `/backend/interworks/content/page/*` | Page content, custom CSS, and custom HTML |
| Terms of Service | `/backend/interworks/content/tos/*` | HTML content and custom CSS |
| Scripts | `/backend/interworks/integration/script/*` | SQL, PowerShell, and Python code |
| Tableau Dashboards | `/backend/interworks/tableauviz/dashboards/*` | JavaScript snippets and HTML descriptions |
| Authentication | `/backend/interworks/portal/authentication` | Certificates and SAML metadata in XML format |

> [!NOTE]
>
> The Portal Settings page is the page that WAFs block most often. Curator sends the contents of the Custom PHP Hooks
> file with every save on this page, even when the **Custom PHP Hooks** setting is turned off. A WAF therefore sees PHP
> source code in the request no matter which setting you changed. On Cloudflare, for example, the managed rule that
> detects PHP code injection is known to block this request.

### Large Requests and File Uploads

Some WAFs block any request whose body is larger than a fixed size, and some inspect only the first part of the
body. Curator sends large request bodies in the following situations:

* **Backend saves:** Pages with many settings, such as Portal Settings, send every field on the page in one request.
  This request can be larger than the body size limit of some WAFs.
* **Imports:** The **Import/Export** page uploads import files to `/backend/interworks/portal/importexport` in parts
  of 10 MB each.
* **File uploads:** File and image uploads are sent to the URL of the backend page that you are on. The
  **Files** page at `/backend/interworks/content/file` accepts many file types, including HTML, JavaScript, and SVG
  files.

If your WAF blocks these requests, ask your WAF administrators to raise the body size limit, or to exclude the
body size rule and the file upload rules, for these paths.

### Requests That Do Not Come From a Browser

Bot protection features, such as JavaScript challenges and CAPTCHA pages, work only when a person is using a
browser. The following requests are made by other systems, which cannot complete a challenge. They should be
excluded from bot protection.

| URL path | Caller |
| - | - |
| `/ping` | Load balancer health checks |
| `/api/v1/*` | Scripts and other systems that use the [Curator API](https://docs.curator.interworks.com/curator_api/api_docs/authentication.md) |
| `/curator/mcp` and `/curator/mcp/upload/*` | AI assistants that connect to Curator's MCP server |
| `/user/oauth` | Your identity provider, when users sign in with OAuth or OpenID Connect |
| `/` | Your identity provider, when users sign in with SAML |

When users sign in with SAML, the identity provider sends a large encoded response to Curator's root address by
default. A WAF that blocks large or encoded request bodies at the root address prevents users from signing in.

### Rate Limiting

Some Curator pages send frequent requests during normal use. The **Import/Export** page checks the progress of a
running import every few seconds, and the search box sends a request shortly after the user stops typing. If your
WAF applies rate limiting, make sure that the limit leaves room for this activity from a single user.

### Headers and Request Methods

The Curator backend sends its own request headers with every save. Your WAF and any proxy in front of Curator must
pass the following headers through to Curator without removing them:

* `X-WINTER-REQUEST-HANDLER`
* `X-WINTER-REQUEST-PARTIALS`
* `X-WINTER-REQUEST-FLASH`
* `X-CSRF-TOKEN`
* `X-XSRF-TOKEN`
* `X-Requested-With`

Curator uses the `GET` and `POST` request methods for almost everything. The `/curator/mcp/upload/*` path also
accepts `PUT` requests.

The headers that a proxy must add, such as `X-Forwarded-For`, are described on the
[Reverse Proxy](https://docs.curator.interworks.com/setup/proxy_configuration/reverse_proxy.md) page.

## Vendor Documentation

Each WAF vendor uses different terms for a scoped exception. The following pages describe how to create one:

* **Cloudflare:** [Handle false positives](https://developers.cloudflare.com/waf/managed-rules/handle-false-positives)
  explains how to add an exception that skips a single managed rule for a specific URL path.
* **AWS WAF:** [Exclude specific requests from inspection](https://aws.amazon.com/premiumsupport/knowledge-center/waf-exclude-specific-requests-inspection/)
  explains how to exclude a URL path from a managed rule, and
  [Managing body inspection size limits](https://docs.aws.amazon.com/waf/latest/developerguide/web-acl-setting-body-inspection-limit.html)
  explains the request body size limits.
* **Azure Application Gateway:** [Request size limits](https://learn.microsoft.com/azure/web-application-firewall/ag/application-gateway-waf-request-size-limits)
  explains the request body inspection and size limits.
* **ModSecurity with the OWASP Core Rule Set:** [False Positives and Tuning](https://coreruleset.org/docs/concepts/false_positives_tuning)
  explains how to write a rule exclusion for a specific URL path.
* **Akamai:** Exceptions are configured for each attack group in a security policy. Refer to Akamai's
  [application security documentation](https://techdocs.akamai.com/application-security/reference/put-attack-group-condition-exception)
  for details.


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