# Help Page proxy

Show your Help Page on your own domain, like your-domain.com/help, using rewrites.

## Overview

Your Help Page lives at https://www.qwryai.com/{agentId}/help. A rewrite (a proxy) shows it at a path on your own site, such as https://your-domain.com/help. When a visitor opens the path on your domain, your server fetches the page from QwryAI and serves it. The address in the visitor's browser does not change.

> **Your agent ID**: Replace {agentId} in every rule with your agent's ID. It is the part of your Help Page address before /help.

## Required routes

Proxy all four paths, or parts of the page will not load:

- /help and /help/*: the Help Page.
- /__qw/*: its static files (JavaScript, CSS, images).
- /api/chat/{agentId}/*: your agent's chat.

## Next.js

1. Open or create next.config.js at the root of your project.
2. Add these rewrites. Place them before any catch-all route.
3. Restart your Next.js server, then redeploy.

```javascript
// next.config.js

/** @type {import('next').NextConfig} */
const nextConfig = {
  async rewrites() {
    return [
      { source: "/help", destination: "https://www.qwryai.com/{agentId}/help" },
      // Sub-pages of your Help Page.
      { source: "/help/:path*", destination: "https://www.qwryai.com/{agentId}/help/:path*" },
      // Static files (JavaScript, CSS, images).
      { source: "/__qw/:path*", destination: "https://www.qwryai.com/__qw/:path*" },
      // Your agent's chat.
      { source: "/api/chat/{agentId}/:path*", destination: "https://www.qwryai.com/api/chat/{agentId}/:path*" },
    ];
  },
};

module.exports = nextConfig;
```

## Vercel

1. Create vercel.json at the root of your project if it doesn't exist.
2. Add these rewrites.
3. Vercel applies them on your next deployment.

```json
// vercel.json
{
  "rewrites": [
    { "source": "/help", "destination": "https://www.qwryai.com/{agentId}/help" },
    { "source": "/help/:path*", "destination": "https://www.qwryai.com/{agentId}/help/:path*" },
    { "source": "/__qw/:path*", "destination": "https://www.qwryai.com/__qw/:path*" },
    { "source": "/api/chat/{agentId}/:path*", "destination": "https://www.qwryai.com/api/chat/{agentId}/:path*" }
  ]
}
```

## Netlify

1. Create or open netlify.toml at the root of your project.
2. Add these rules. status = 200 serves the page without changing the address.
3. Netlify applies them on your next deploy.

```toml
# netlify.toml
# status = 200 serves the page without changing the address (a rewrite, not a redirect).

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

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

# Static files (JavaScript, CSS, images).
[[redirects]]
  from = "/__qw/*"
  to = "https://www.qwryai.com/__qw/:splat"
  status = 200
  force = true

# Your agent's chat.
[[redirects]]
  from = "/api/chat/{agentId}/*"
  to = "https://www.qwryai.com/api/chat/{agentId}/:splat"
  status = 200
  force = true
```

## Node.js (Express)

1. Install http-proxy-middleware: npm install http-proxy-middleware.
2. Register these proxies before any body parser or catch-all route.
3. Restart your server.

```javascript
// server.js
const express = require("express");
const { createProxyMiddleware } = require("http-proxy-middleware");

const app = express();
const under = (base) => (path) => path === base || path.startsWith(`${base}/`);

// Register the proxies before body parsers.
app.use(createProxyMiddleware({
  target: "https://www.qwryai.com",
  changeOrigin: true,
  pathFilter: under("/help"),
  pathRewrite: (path) => path.replace(/^\/help(?=\/|\?|$)/, "/{agentId}/help"),
}));
app.use(createProxyMiddleware({ target: "https://www.qwryai.com", changeOrigin: true, pathFilter: under("/__qw") }));
// Your agent's chat, including its live connection.
app.use(createProxyMiddleware({ target: "https://www.qwryai.com", changeOrigin: true, ws: true, pathFilter: under("/api/chat/{agentId}") }));

app.listen(process.env.PORT || 3000);
```

## Check it works

- Open your-domain.com/help and confirm the Help Page loads with your logo and colors.
- Send several messages and wait for each full reply.
- Open a suggested message, a link card and Recent chats.
- Reload the page and confirm the conversation is still there.

> **Live connection**: Vercel and Netlify rewrites don't carry WebSocket connections, so on those hosts the chat keeps its live connection over regular HTTP requests. Replies still arrive as they're written.

## Related guides

- [Help Page](/docs/user-guides/agent-management/help-page)
