Publish a Page on your website's subpath
Serve your Chatbyte Page at an address such as example.com/support.
Use this developer guide to serve a Page at a path on your existing
website, such as https://example.com/support. Your website's server forwards
requests for that path to Chatbyte. The rest of your website keeps its existing
hosting and address.
Download the server adapter and save it as proxy.ts
in your backend project. Keep this code and its credentials on the server.
Configure the connection
- Open your agent's Publish → Pages → Domains settings. Enter your hostname and
a path such as
/supportor/help/support. - Copy the connection ID and one-time proxy key into your server's secret store. Keep the key available for your deployment; it is shown once.
- Add the displayed
_chatbyte-pagesownership TXT record alongside your existing DNS records. Keep your website's hosting and HTTPS configuration. - Install the adapter below, routing both the exact mount and its descendants,
plus
/_chatbyte-pages-assets/*. The asset prefix is deliberately separate from your website's own/_nextfiles. Route the asset prefix to the same Pages gateway as the document. If your setup uses a separate asset CDN, allow that origin in your website's Content Security Policy. - Choose Verify after deploying the adapter and adding the DNS record. Chatbyte checks ownership and the connection to your server.
- Publish the Page and select the subpath as its primary address when ready.
Use https://www.chatbyte.page as the production Pages gateway origin. For a
separate test environment, confirm the matching gateway address with Chatbyte.
Cloudflare Worker or Fetch-compatible server
The adapter uses standard Request/Response streams. This example mounts the Page
at https://example.com/support:
import { createPageProxy } from './proxy';
interface ProxyEnvironment {
CHATBYTE_PAGES_PROXY_KEY: string;
}
export default {
fetch(request: Request, env: ProxyEnvironment) {
return createPageProxy({
publicOrigin: 'https://example.com',
pathPrefix: '/support',
gatewayOrigin: 'https://www.chatbyte.page',
domainId: '<connection-id>',
pageSurfaceId: '<page-surface-id>',
proxyKey: env.CHATBYTE_PAGES_PROXY_KEY,
// Cloudflare supplies this field. On other hosts use their trusted metadata.
clientAddress: (request) => request.headers.get('CF-Connecting-IP'),
})(request);
},
};Configure Worker routes for example.com/support* and
example.com/_chatbyte-pages-assets/*. The adapter rejects sibling paths such as
/support-other; use exact route exclusions or invoke it from the website's
existing router if those paths exist. Allow streaming responses through your
server and keep its timeout compatible with the Pages 300-second streaming limit.
Keep caching disabled for Page documents and API responses.
If you customize fetchUpstream, preserve Fetch's automatic decompression and
streaming behavior. Your host or CDN can compress the response sent to visitors.
The proxy strips application cookies, Authorization and arbitrary forwarding
headers. It forwards only this Page's host-only cookie or its dedicated
X-Pages-Session credential. Client IP forwarding is optional and must come from
trusted hosting metadata. A user-supplied X-Forwarded-For is not an identity.
For a private Page, also implement private Page sign-in. Your backend authenticates the visitor and supplies their authorized account and roles. Keep the proxy key, private signing key, and identity-provider access tokens on your backend.
Check your published Page
Open the full address on your website after publishing. Check that the Page and its images load, send a message, and reload to check the conversation. Check that the rest of your website still works as expected. For a private Page, also test sign-in, sign-out, account switching, and a visitor who should not have access.
If the connection needs attention, open its domain card to review the message. Check the DNS record, deployed routes, and server credentials, then choose Verify to retry. Keep the adapter's hostname, path, Page ID, and origin checks enabled while troubleshooting.
To replace a lost key, choose Replace proxy key, update your server's secret, and verify again. Replacing a key immediately invalidates the previous one. Removing a connection stops Chatbyte routing for that address; also update your website's routes if you are retiring the integration.
Routing and redirects
Configure the hostname and path through the adapter's publicOrigin and
pathPrefix options. Preserve its manual redirect handling so navigation stays
within the configured Page address. See Pages
if you prefer a dedicated domain instead of a subpath.