> For the complete documentation index, see [llms.txt](https://docs.usepylon.com/pylon-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.usepylon.com/pylon-docs/chat-widget/custom-domain.md).

# Custom Domain

Serve the Chat Widget from your own domain

Serve the Chat Widget from a domain you own, such as `chat.example.com`, instead of a Pylon domain. With a custom domain, the widget script, its requests to Pylon, its real-time connection, and Pylon-hosted images, fonts, and attachments all load through your domain.

{% hint style="info" %}
Custom chat widget domains are available on the Enterprise plan.
{% endhint %}

One custom domain covers every chat widget in your organization. Existing embed snippets that don't use the custom domain keep working.

## Set up a custom domain

{% stepper %}
{% step %}

### Add your domain

Go to **Settings > Communications > Chat widget** and click **Custom Domain** ([US](https://app.usepylon.com/settings/chat-widget/custom-domain), [EU](https://app.eu.usepylon.com/settings/chat-widget/custom-domain)). Enter your domain, for example `chat.example.com`, and click **Set Up**.
{% endstep %}

{% step %}

### Add the DNS records

Under **DNS records**, Pylon lists two records. Add both with your DNS provider.

The status shows **Pending verification** until the records are found. Verification can take up to 30 minutes after the records are in place, and the page updates on its own.

If the status changes to **Verification failed**, check the records, including any CAA policy on your domain, then click **Retry**.
{% endstep %}

{% step %}

### Update your embed snippet

Once the domain shows **Verified**, an **Embed snippet** section appears. Pick the chat widget you're installing and copy its snippet. It loads the widget from `https://<your-domain>/widget/embed/<APP_ID>`.

Use this snippet in place of the one in [Chat Setup](/pylon-docs/chat-widget/chat-setup.md) step 2. The rest of the setup, including `window.pylon.chat_settings`, stays the same.
{% endstep %}
{% endstepper %}

## Content Security Policy

If your site has a CSP, start from the policy in [Chat Setup](/pylon-docs/chat-widget/chat-setup.md) and add your custom domain. For `chat.example.com`:

```
Content-Security-Policy: 
    connect-src 'self' https://*.usepylon.com wss://*.pusher.com https://*.pusher.com https://chat.example.com wss://chat.example.com;
    script-src 'self' https://widget.usepylon.com https://chat.example.com;
    font-src 'self' https://*.usepylon.com https://chat.example.com;
    style-src 'self' 'unsafe-inline' https://*.usepylon.com;
    img-src 'self' https://*.usepylon.com https://pylon-avatars.s3.us-west-1.amazonaws.com https://chat.example.com;
```

Keep the Pylon entries: some widget requests still go directly to Pylon. If you use EU data hosting, start from the EU policy instead.

## Change or remove the domain

To use a different domain, enter it and click **Update**, then add the new DNS records.

To stop using a custom domain, click **Remove**. Embeds that use the custom-domain snippet stop working, so switch them back to the standard snippet first. Embeds that use the standard snippet aren't affected.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.usepylon.com/pylon-docs/chat-widget/custom-domain.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
