Advanced Integration
Help Page Proxy
Show your QwryAI Help Page on your own domain, like your-domain.com/help, using rewrites (proxies)
This guide shows how to use rewrites, also called proxies, to show your QwryAI Help Page on your own domain. Visitors read your help content and chat with your agent without leaving your site.
Your Help Page normally lives at https://www.qwryai.com/YOUR_AGENT_ID/help. With a rewrite, it appears at a path such as https://your-domain.com/help.
The Core Concept: Rewrites
A rewrite works as a proxy. When a visitor opens the source path on your domain, your server fetches the page from the destination URL and serves it. The address in the visitor's browser doesn't change.
- Source: the path on your website you want to use.
- Destination: the full address of your QwryAI Help Page.
- Open the Help Page deploy sheet
In your agent, open Channels, select Manage on the Help page card, then select Deploy in the top-right corner. The Deploy Help Page sheet lists a guide for each host.
Deploy Help Page: open your page and pick your host.
- Copy your Help Page address
Next to Visit page, select the open icon. Your Help Page opens in a new tab; copy its address. The part before
/helpis your agent's ID. Use it wherever the examples below showYOUR_AGENT_ID.
Implementation Examples
Choose the tab for your framework or hosting platform.
For Next.js projects, add rewrites to your next.config.js file.
- Open or create
next.config.jsat the root of your project. - Add the
rewritesfunction to the config. Place the rules before any catch-all route.
// next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
async rewrites() {
return [
{
source: "/help",
destination: "https://www.qwryai.com/YOUR_AGENT_ID/help",
},
// Static files (JavaScript, CSS, images)
{
source: "/__qw/:path*",
destination: "https://www.qwryai.com/__qw/:path*",
},
// Your agent's chat
{
source: "/api/chat/YOUR_AGENT_ID/:path*",
destination: "https://www.qwryai.com/api/chat/YOUR_AGENT_ID/:path*",
},
];
},
};
module.exports = nextConfig;Restart your Next.js server to apply the changes, then redeploy.
If your site is on Vercel, whatever its framework, add the rewrites in a vercel.json file.
- Create
vercel.jsonat the root of your project if it doesn't exist. - Add a
rewritesarray.
{
"rewrites": [
{
"source": "/help",
"destination": "https://www.qwryai.com/YOUR_AGENT_ID/help"
},
{
"source": "/__qw/:path*",
"destination": "https://www.qwryai.com/__qw/:path*"
},
{
"source": "/api/chat/YOUR_AGENT_ID/:path*",
"destination": "https://www.qwryai.com/api/chat/YOUR_AGENT_ID/:path*"
}
]
}Vercel applies these rules on your next deployment.
For sites on Netlify, add the rules to your netlify.toml file.
- Create or open
netlify.tomlat the root of your project. - Add these rules.
status = 200serves the page without changing the address: a rewrite, not a redirect.
# netlify.toml
[[redirects]]
from = "/help"
to = "https://www.qwryai.com/YOUR_AGENT_ID/help"
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/YOUR_AGENT_ID/*"
to = "https://www.qwryai.com/api/chat/YOUR_AGENT_ID/:splat"
status = 200
force = trueCommit and push the file; Netlify applies the rules on the next deploy.
On your own Node.js server with Express, use the http-proxy-middleware package.
- Install the packages:
npm install express http-proxy-middleware- Add the proxies to your app, before any body parser or catch-all route.
// server.js
const express = require("express");
const { createProxyMiddleware } = require("http-proxy-middleware");
const app = express();
const AGENT_ID = process.env.QWRYAI_AGENT_ID; // YOUR_AGENT_ID
const under = (base) => (path) => path === base || path.startsWith(`${base}/`);
// The Help Page
app.use(createProxyMiddleware({
target: "https://www.qwryai.com",
changeOrigin: true,
pathFilter: (path) => path === "/help",
pathRewrite: () => `/${AGENT_ID}/help`,
}));
// Static files (JavaScript, CSS, images)
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/${AGENT_ID}`),
}));
app.listen(process.env.PORT || 3000);Check it works
- Open
your-domain.com/helpand check that the Help Page loads with your logo and colors. - Send a few messages and wait for each full reply.
- Reload the page and check that the conversation is still there.