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

# Serve agents from your domain

> Give agents one address on your own domain, such as agents.example.com, for your ARV records, search and MCP server.

By default, agents reach your library on AgentTV hosts. You can serve the same endpoints from a host on your own domain, for example `agents.example.com`. Agents then call your brand's address, and every URL in the answers uses it.

## Without a CDN in front

In the console, open **Discovery**, then the **Domain** tab in the **Your website** card, and set up a branded address. Or call `POST /v1/website` with `set_up`. Then add one DNS record at your DNS provider:

```text theme={null}
agents  CNAME  domains.agentcdn.com
```

Keep the record DNS only, not proxied. AgentTV issues the TLS certificate. Run the website check (`POST /v1/website/{site_id}/check`) to move the address to live.

## With your own CDN in front

When your CDN owns the host and its certificate, the CDN forwards each request to AgentTV:

| Setting | Value |
| - | - |
| Viewer host | `agents.example.com`, on your CDN, with your certificate |
| Origin | `api.agentcdn.com`, HTTPS only, port 443 |
| `Host` header to the origin | `api.agentcdn.com` |
| TLS to the origin | SNI `api.agentcdn.com`, verify the certificate |
| Extra request header | `X-Forwarded-Host: agents.example.com` |
| Methods | All: `GET`, `HEAD`, `OPTIONS`, `POST`, `PUT`, `PATCH`, `DELETE` |
| Path, query, headers, body | Pass through unchanged |

AgentTV reads your host from `X-Forwarded-Host` and binds the request to your account. Without that header, the request reaches the shared platform routes, not your catalog.

Do not rewrite paths, strip query strings, or drop `Accept`, `Content-Type`, `Authorization` or `Mcp-Session-Id`. The MCP endpoint answers with `text/event-stream`, so the CDN must not buffer or change that response.

### Cache rules

* Keep `Cache-Control` as sent. Public metadata is marked `public`. Anything tied to rights, playback or one viewer is `private, no-store`.
* Keep `ETag` and pass `If-None-Match` through.
* Never cache a `404`. Most CDNs cache a 404 by default for seconds to minutes, which would hide a new video.
* Keep the query string in the cache key.
* Do not cache a response that has no `Cache-Control`: set the default TTL to 0.

### Cloudflare on any plan

A small Worker on a Custom Domain does the forward:

```js theme={null}
// Forwards agents.example.com to AgentTV without changing the request.
const ORIGIN = "https://api.agentcdn.com";

export default {
  async fetch(request) {
    const incoming = new URL(request.url);
    const upstream = new URL(incoming.pathname + incoming.search, ORIGIN);
    const headers = new Headers(request.headers);
    headers.delete("Host");
    headers.set("X-Forwarded-Host", incoming.host);
    return fetch(upstream, {
      method: request.method,
      headers,
      body: request.body,
      redirect: "manual",
      cf: { cacheTtlByStatus: { "400-599": -1 } },
    });
  },
};
```

Add `agents.example.com` as a Custom Domain on the Worker. Do not add a Cache Rule that forces caching on this host.

We have checked templates for Cloudflare Enterprise rules, Amazon CloudFront, Fastly and Akamai. Ask us for the one you use. You apply the rule in your own CDN account. We run the checks with you.


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