> For the complete documentation index, see [llms.txt](https://docs.aisuru.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aisuru.com/en/frontend/content-security-policy.md).

# Content Security Policy

#### Overview

If the website where you embed your Agent uses a **Content Security Policy** (CSP), you need to add the hosts used by the Web Component to the policy. Without these entries the browser blocks the component's requests, and the Agent does not load, or loads only in part.

On this page you will find:

* the ready-to-use policy for **AIsuru SaaS** (`www.aisuru.com`) and for **PaaS**;
* the policy with placeholders for **other installations**;
* why each entry is needed and what happens if you leave it out;
* the recommended procedure for rolling it out.

#### Why your page's CSP is the one that matters

The Web Component is not isolated from the page that hosts it: `<memori-client>` uses neither an iframe nor the shadow DOM, and mounts directly into your page's document.

Every request the component makes (API calls, WebSocket, fonts, audio, avatar models) is therefore evaluated by the browser against **your page's CSP**. For the same reason we cannot set the policy for you: the header is under your control.

{% hint style="info" %}
The same policy also applies to the React Component, which runs inside your application in the same way.
{% endhint %}

#### Policy for AIsuru SaaS and PaaS

If your Agent is on **AIsuru SaaS** (`www.aisuru.com`), you can copy this policy as it is. Send it as a **response header** of the page that contains `<memori-client>`:

{% code overflow="wrap" %}

```
Content-Security-Policy:
  default-src 'none';
  script-src  'self' https://cdn.jsdelivr.net;
  style-src   'self' 'unsafe-inline' https://cdn.jsdelivr.net https://fonts.bunny.net;
  font-src    'self' data: https://cdn.jsdelivr.net https://fonts.bunny.net;
  img-src     'self' data: blob: https:;
  media-src   'self' blob: data: https://www.aisuru.com https://assets.memori.ai;
  connect-src 'self' https://www.aisuru.com
              https://backend-proxy.aisuru.com https://backend.memori.ai
              https://engine.memori.ai https://assets.memori.ai
              wss://nats.memori.ai
              https://pulse.aisuru.com
              https://status.claude.com https://status.openai.com https://status.mistral-data.com
              blob: data:;
  frame-src   'self' blob: data: https:;
  worker-src  'self' blob:;
  form-action 'self';
  base-uri    'self';
```

{% endcode %}

The policy covers every feature of the component. If your page loads other resources as well, add them to the same directives.

**If you use a PaaS**

A PaaS uses the same services as AIsuru SaaS: only the **domain of your platform** changes, which is the one you find in the `tenantID` and `baseURL` attributes of the embed code. Replace `www.aisuru.com` with your domain in the `media-src` and `connect-src` directives. For example, with the PaaS on `ai.your-company.com`:

```
  media-src   'self' blob: data: https://ai.your-company.com https://assets.memori.ai;
  connect-src 'self' https://ai.your-company.com
              https://backend-proxy.aisuru.com https://backend.memori.ai
              ...
```

All the other lines stay the same.

**The hosts in the policy**

| Host                                                                | What it is for                                                                         |
| ------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| `www.aisuru.com` (or your PaaS domain)                              | The component's server-side services: text-to-speech, speech-to-text, session events   |
| `backend-proxy.aisuru.com`, `backend.memori.ai`                     | Platform API: sessions, Agents, assets, authentication                                 |
| `engine.memori.ai`                                                  | Conversation engine                                                                    |
| `assets.memori.ai`                                                  | Stored assets: avatars, backgrounds, media, uploaded documents                         |
| `nats.memori.ai`                                                    | WebSocket channel for real-time session events                                         |
| `cdn.jsdelivr.net`                                                  | The component's code and stylesheet, plus the libraries for formulas and code snippets |
| `fonts.bunny.net`                                                   | The component's font                                                                   |
| `pulse.aisuru.com`                                                  | An anonymous signal sent when the component loads                                      |
| `status.claude.com`, `status.openai.com`, `status.mistral-data.com` | Model provider status indicator                                                        |

The Web Component automatically replaces `backend.memori.ai` with `backend-proxy.aisuru.com`, so the request goes to the proxy even if the embed code says `backend.memori.ai`. The React Component does not make this substitution, which is why the policy lists both.

{% hint style="info" %}
Want a more compact policy? The wildcards `https://*.aisuru.com https://*.memori.ai wss://*.memori.ai` cover all the `aisuru.com` and `memori.ai` hosts in the `connect-src` directive at once.
{% endhint %}

You do not need to allow model or voice providers (for example OpenAI or Azure): the browser never contacts them directly. Text-to-speech and speech-to-text go through the platform's services, which keep the keys server-side.

#### Policy for other installations

If your Agent is on a dedicated or on-premise installation, the hosts change. Use this policy and replace the placeholders with your installation's values:

{% code overflow="wrap" %}

```
Content-Security-Policy:
  default-src 'none';
  script-src  'self' https://cdn.jsdelivr.net;
  style-src   'self' 'unsafe-inline' https://cdn.jsdelivr.net https://fonts.bunny.net;
  font-src    'self' data: https://cdn.jsdelivr.net https://fonts.bunny.net;
  img-src     'self' data: blob: https:;
  media-src   'self' blob: data: https://<tenant-host> https://<assets-host>;
  connect-src 'self' https://<tenant-host> https://<backend-host> https://<engine-host>
              https://<assets-host> wss://<nats-host>
              https://pulse.aisuru.com
              https://status.claude.com https://status.openai.com https://status.mistral-data.com
              blob: data:;
  frame-src   'self' blob: data: https:;
  worker-src  'self' blob:;
  form-action 'self';
  base-uri    'self';
```

{% endcode %}

| Placeholder      | What it is                                                    | Where to find it                                                 |
| ---------------- | ------------------------------------------------------------- | ---------------------------------------------------------------- |
| `<tenant-host>`  | Platform domain, serving the component's server-side services | `baseURL` attribute of the embed code (or `tenantID` if missing) |
| `<backend-host>` | Platform API                                                  | `apiURL` attribute                                               |
| `<engine-host>`  | Conversation engine                                           | `engineURL` attribute                                            |
| `<assets-host>`  | Stored assets: avatars, backgrounds, media, documents         | Address of the Agent's assets (for example the avatar URL)       |
| `<nats-host>`    | WebSocket channel for session events                          | Provided by the team that manages the installation               |

The other hosts (`cdn.jsdelivr.net`, `fonts.bunny.net`, `pulse.aisuru.com` and the three `status.*`) are the same for every installation.

{% hint style="warning" %}
If your installation's WebSocket channel answers on a port other than 443, you must state it explicitly, for example `wss://nats.your-company.com:8080`. A source without a port only matches the default port.
{% endhint %}

#### Directive by directive

| Directive     | Entry                                 | Why it is needed                                                                                               |
| ------------- | ------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| `script-src`  | `https://cdn.jsdelivr.net`            | The component's code; also the libraries loaded when the Agent shows a code snippet or a formula               |
| `style-src`   | `'unsafe-inline'`                     | The component applies theme colours and layout sizes through inline styles                                     |
| `style-src`   | `cdn.jsdelivr.net`, `fonts.bunny.net` | The component's stylesheet imports the formula styles and the font                                             |
| `font-src`    | the same two hosts, plus `data:`      | The font files                                                                                                 |
| `img-src`     | `data:`, `blob:`                      | Placeholder images, QR codes and image previews before upload                                                  |
| `img-src`     | `https:`                              | Answers and link previews can contain images from any website: narrowing this entry breaks the Agent's content |
| `media-src`   | `blob:`                               | Synthesised speech is played locally                                                                           |
| `media-src`   | tenant and asset hosts                | Audio and video attached to answers                                                                            |
| `connect-src` | tenant host                           | Text-to-speech, speech-to-text and session event configuration                                                 |
| `connect-src` | backend and engine hosts              | Sessions, Agent information, asset upload and the conversation itself                                          |
| `connect-src` | `wss://` of the event channel         | Real-time session events                                                                                       |
| `connect-src` | `pulse.aisuru.com`                    | One anonymous event each time the component loads (not sent on localhost)                                      |
| `connect-src` | the three `status.*` hosts            | Model provider status indicator                                                                                |
| `connect-src` | `blob:`, `data:`                      | Reading locally produced files, for example during document upload and PDF export                              |
| `frame-src`   | `blob:`, `data:`                      | PDF previews                                                                                                   |
| `frame-src`   | `https:`                              | Link previews can embed external video players, such as YouTube or Vimeo                                       |

The component requires neither `'unsafe-eval'` nor `'wasm-unsafe-eval'`. If a violation report shows one of them, it comes from another part of your page.

#### Optional features

If you want a stricter policy, you can give up some entries. The table shows what to add for features not covered by the base policy, and what happens if you leave the entries out.

| Feature                 | Entries to add or remove                                                                                                                                        | If you leave them out                                                                                                                                               |
| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Model status indicator  | `connect-src` to the three `status.*` hosts (already in the base policy)                                                                                        | The indicator does not appear and you only see an error in the console. If you want it, allow all three hosts: the one used changes with the Agent's model provider |
| Maps and places         | `script-src` and `style-src https://unpkg.com`; `img-src https://unpkg.com https://*.tile.openstreetmap.org`; `connect-src https://nominatim.openstreetmap.org` | The map is not shown and place search does not work                                                                                                                 |
| Custom 3D models        | `script-src https://unpkg.com`                                                                                                                                  | Custom GLB models are not shown                                                                                                                                     |
| Ready Player Me avatars | `connect-src` and `img-src https://models.readyplayer.me`                                                                                                       | The avatar falls back to the default one or is not shown                                                                                                            |
| Voice input             | No CSP entry, but the `Permissions-Policy: microphone=(self)` header and a page served over HTTPS                                                               | The microphone button does not work                                                                                                                                 |
| Interactive artifacts   | `script-src 'unsafe-inline'`                                                                                                                                    | Artifacts inherit your page's CSP: the content appears, but the scripts inside it do not run. In most cases it is better to accept this                             |
| Load signal             | `connect-src https://pulse.aisuru.com` (already in the base policy)                                                                                             | Nothing breaks                                                                                                                                                      |

#### Watch out for

* **Wildcards and the bare domain**: `https://*.aisuru.com` covers `www.aisuru.com` but not `aisuru.com`. If you use the domain without a subdomain, list both;
* **`data:` and `blob:`**: they are schemes, not hosts, and must be repeated in every directive that needs them. A violation that reports a `data:` or `blob:` URL almost always concerns `img-src`, `media-src` or `frame-src`;
* **Header or `<meta>` tag**: if you send the policy through a `<meta>` tag, the `frame-ancestors`, `report-uri` and `sandbox` directives are ignored. Prefer the header;
* **`frame-ancestors`**: it does not concern the Web Component, which is not an iframe. It only matters if you embed an AIsuru page in an iframe, and in that case it is set by the platform, not by your page.

#### How to roll out the policy

1. **Publish the policy in report-only mode**
   * Use the `Content-Security-Policy-Report-Only` header instead of `Content-Security-Policy`;
   * The browser reports violations without blocking anything.
2. **Try the whole conversation**
   * Send a text message;
   * Try voice input and output;
   * Open an answer with images or video;
   * Upload a document and open an artifact.
3. **Check the reports**
   * Each violation points to a host or scheme to add to a directive;
   * Compare it with the tables on this page.
4. **Enforce the policy**
   * Switch to `Content-Security-Policy` only when you no longer receive reports.

{% hint style="warning" %}
Do not rely on a visual check alone: some features, such as the model status indicator, stop working without showing any error on the page. CSP reports and the browser console are the only reliable way to find them.
{% endhint %}
