Developer Guides

Help Page Proxy

Serve your Chatmount help page from your own domain — visitors stay on your-domain.com/help while Chatmount handles rendering and the chat API.

Overview

The Help Page proxy uses server-side rewrites to mount your Chatmount help page under your own domain. Your visitors hit https://your-domain.com/help and the URL bar stays on your domain — but the page, assets, and chat API all stream from Chatmount transparently.

Replace {agentId}in every snippet below with the UUID of the chatbot whose help page you’re publishing. You can find this in your dashboard URL — chatmount.co/dashboard/…/chatbot/{agentId}.

Routes to proxy

A working Help Page proxy needs four rewrites in place. Skipping any one of these will leave the page broken in subtle ways — missing fonts, blank chat, or 404s on link cards.

  • /helphttps://www.chatmount.co/help/{agentId} — the help page itself
  • /help/:path* https://www.chatmount.co/help/{agentId}/:path* — sub-routes (recent chat session URLs etc.)
  • /__cb/:path* https://www.chatmount.co/__cb/:path* — static assets (logo, favicon, fonts, JS bundles)
  • /api/chat/{agentId}/:path* https://www.chatmount.co/api/chat/{agentId}/:path* — the chat API the page calls

Next.js

Add the rewrites to your next.config.js. Works on every Next.js version with the App Router and Pages Router alike.

next.config.js
// next.config.js
module.exports = {
  async rewrites() {
    return [
      {
        source: "/help",
        destination: "https://www.chatmount.co/help/{agentId}",
      },
      {
        source: "/help/:path*",
        destination: "https://www.chatmount.co/help/{agentId}/:path*",
      },
      {
        source: "/__cb/:path*",
        destination: "https://www.chatmount.co/__cb/:path*",
      },
      {
        source: "/api/chat/{agentId}/:path*",
        destination: "https://www.chatmount.co/api/chat/{agentId}/:path*",
      },
    ];
  },
};

Vercel

If you’re hosting a non-Next.js project on Vercel, drop a vercel.json at the root of your repo with the following config.

vercel.json
{
  "rewrites": [
    {
      "source": "/help",
      "destination": "https://www.chatmount.co/help/{agentId}"
    },
    {
      "source": "/help/:path*",
      "destination": "https://www.chatmount.co/help/{agentId}/:path*"
    },
    {
      "source": "/__cb/:path*",
      "destination": "https://www.chatmount.co/__cb/:path*"
    },
    {
      "source": "/api/chat/{agentId}/:path*",
      "destination": "https://www.chatmount.co/api/chat/{agentId}/:path*"
    }
  ]
}

Netlify

Add the redirects to netlify.toml. The status = 200 + force = true combination tells Netlify to proxy (not redirect) so the URL bar stays on your domain.

netlify.toml
# netlify.toml

[[redirects]]
  from = "/help"
  to = "https://www.chatmount.co/help/{agentId}"
  status = 200
  force = true

[[redirects]]
  from = "/help/*"
  to = "https://www.chatmount.co/help/{agentId}/:splat"
  status = 200
  force = true

[[redirects]]
  from = "/__cb/*"
  to = "https://www.chatmount.co/__cb/:splat"
  status = 200
  force = true

[[redirects]]
  from = "/api/chat/{agentId}/*"
  to = "https://www.chatmount.co/api/chat/{agentId}/:splat"
  status = 200
  force = true

Node.js

For self-hosted Node servers, use http-proxy-middleware with Express. Install with npm install http-proxy-middleware and wire it in before your other route handlers.

server.js
// server.js — Express + http-proxy-middleware
const express = require("express");
const { createProxyMiddleware } = require("http-proxy-middleware");

const app = express();
const TARGET = "https://www.chatmount.co";
const AGENT_ID = "{agentId}";

// /help and /help/* → /help/{agentId} on Chatmount
app.use(
  "/help",
  createProxyMiddleware({
    target: TARGET,
    changeOrigin: true,
    pathRewrite: (path) => `/help/${AGENT_ID}${path === "/" ? "" : path}`,
  }),
);

// Static assets the help page depends on
app.use(
  "/__cb",
  createProxyMiddleware({
    target: TARGET,
    changeOrigin: true,
  }),
);

// Chat API — must be passed through verbatim
app.use(
  `/api/chat/${AGENT_ID}`,
  createProxyMiddleware({
    target: TARGET,
    changeOrigin: true,
  }),
);

app.listen(3000);

Notes

  • All four rewrites are required. Missing the /__cb/* rewrite is the most common bug — the page loads but renders unstyled.
  • The chat API path includes the agent id twice — once in the source pattern and once in the destination — that’s intentional. Chatmount uses the id in both the URL and the request body.
  • Proxied help pages don’t auto-appear in your sitemap.xml. If SEO matters, add the URLs to your sitemap manually.
  • For framework setups not listed here (Cloudflare Workers, Caddy, nginx, AWS CloudFront) the same four routes apply — translate the rewrite syntax to your platform.

Related