Advanced Integration

Help Page Proxy

Serve your published MuChat dedicated page on your own domain using page, asset, and chat API rewrites.

Use rewrites to display your MuChat dedicated conversation page on your website's domain. Visitors can open chat at an address such as https://your-domain.com/help while keeping that address in their browser.

The destination is your published page at https://widget.mu.chat/standalone?slug=YOUR_SLUG.

Publish and enable your dedicated page first. The proxy serves that existing page; its content and appearance remain configured in MuChat. This method uses your website's server or hosting rules and does not require the widget embed script.

The Core Concept: Rewrites

A rewrite forwards a request to another URL and returns its response without redirecting the visitor. Your domain stays in the address bar.

  • Source: The path on your website, such as /help.
  • Destination: The published MuChat page, including its slug query parameter.

Replace YOUR_SLUG in the examples with the saved address from Deploy → Dedicated page (Muchat Link) → Manage → Publish → Page URL. Use Visit page to check it. The slug is the value after slug= in that link, not the agent ID or the website widget token. If you change it later, update the page and API proxy rules together.

Required routes

Proxy all three paths:

  • /help → https://widget.mu.chat/standalone?slug=YOUR_SLUG — the conversation page.
  • /__mu/* → https://widget.mu.chat/__mu/* — scripts, styles, fonts, images, and other page assets.
  • /api/muchat/v2/standalone/YOUR_SLUG/* → https://api.mu.chat/v2/standalone/YOUR_SLUG/* — this page's HTTP chat requests, including forms, uploads, and streamed responses.

Preserve request methods, bodies, query parameters, X-Auth-Token, cookies, and upstream response headers, including Set-Cookie and Cache-Control. Keep the page and chat API out of shared caches, and forward streamed responses without buffering the entire body.

MuChat's dedicated page is a single conversation page; these examples do not create /help/* subpages. Live updates connect directly to MuChat's API through WebSocket, so a /socket.io proxy rule is not needed.

If your site uses locale routing, authentication middleware, or a catch-all route, let the page, asset, and scoped API paths reach their proxy rules. Apply a compatible content security policy to /help so its scripts, fonts, media, API requests, and direct WebSocket connection can load.

Implementation Examples

Choose the tab for your framework or hosting platform. Merge these rules with your existing configuration and keep them ahead of broader fallback rules.

Add a rewrites function to your project's next.config.js. Replace YOUR_SLUG once in the constant below:

next.config.js
const SLUG = "YOUR_SLUG";

/** @type {import('next').NextConfig} */
const nextConfig = {
  async rewrites() {
    return [
      {
        source: "/help",
        destination: `https://widget.mu.chat/standalone?slug=${SLUG}`
      },
      {
        source: "/__mu/:path*",
        destination: "https://widget.mu.chat/__mu/:path*"
      },
      {
        source: `/api/muchat/v2/standalone/${SLUG}/:path*`,
        destination: `https://api.mu.chat/v2/standalone/${SLUG}/:path*`
      }
    ];
  }
};

module.exports = nextConfig;

Restart the development server after changing the configuration, then deploy it to your server or hosting platform. External rewrites require a server; they do not work with a static HTML export. If your project uses next.config.mjs, use export default nextConfig instead of module.exports.

After deployment, open /help directly and refresh it. Confirm the address stays on your domain, assets load from /__mu/, and HTTP chat requests reach /api/muchat/v2/standalone/YOUR_SLUG/. Send a question, wait for the complete streamed reply, and test any enabled forms or uploads. Refresh again to check that the conversation session continues. Checking only the initial page is not enough to verify the proxy.

Sitemaps

Adding a rewrite does not automatically add /help to your website's sitemap. Include the public address yourself if you want the page listed. A sitemap entry alone does not guarantee indexing.

MuChat documentation

On this page