Put your help center on a sub-folder with Vercel
Serve your help center at a path on a site hosted on Vercel, such as yourcompany.com/help, by adding proxy routes to vercel.json.
Needs a payment method on file, which a trial with a card meets. Owners and admins can change this.
Set the sub-folder in Ferndesk
In Help Center > Customize > Custom Domain, choose Custom sub-folder, enter your site's domain and a path such as /help, and click Configure subdirectory. Copy the Proxy host we show you (it looks like yourcompany.hc.ferndesk.com). The examples below use /help and www.yourcompany.com; replace them with your own.
Add the routes
Add this to vercel.json in your project root (merge it with what's there), then replace three placeholders:
__PUBLIC_HOST__: your production hostname, such aswww.yourcompany.com. Use the production hostname, not a preview URL.__FERNDESK_HOST__: the proxy host.__BASE_PATH__: your path, with the leading slash, such as/help.
{
"$schema": "https://openapi.vercel.sh/vercel.json",
"headers": [
{
"source": "/_ferndesk",
"headers": [
{ "key": "x-vercel-enable-rewrite-caching", "value": "0" }
]
},
{
"source": "/_ferndesk/:match*",
"headers": [
{ "key": "x-vercel-enable-rewrite-caching", "value": "0" }
]
},
{
"source": "__BASE_PATH__",
"headers": [
{ "key": "x-vercel-enable-rewrite-caching", "value": "0" }
]
},
{
"source": "__BASE_PATH__/:match*",
"headers": [
{ "key": "x-vercel-enable-rewrite-caching", "value": "0" }
]
}
],
"routes": [
{
"src": "/_ferndesk",
"dest": "https://__FERNDESK_HOST__/_ferndesk?__bp=__BASE_PATH__",
"transforms": [
{ "type": "request.headers", "op": "set", "target": { "key": "x-ferndesk-base-path" }, "args": "__BASE_PATH__" },
{ "type": "request.headers", "op": "set", "target": { "key": "x-forwarded-host" }, "args": "__PUBLIC_HOST__" },
{ "type": "request.headers", "op": "set", "target": { "key": "x-ferndesk-original-host" }, "args": "__PUBLIC_HOST__" }
]
},
{
"src": "/_ferndesk/(.*)",
"dest": "https://__FERNDESK_HOST__/_ferndesk/$1?__bp=__BASE_PATH__",
"transforms": [
{ "type": "request.headers", "op": "set", "target": { "key": "x-ferndesk-base-path" }, "args": "__BASE_PATH__" },
{ "type": "request.headers", "op": "set", "target": { "key": "x-forwarded-host" }, "args": "__PUBLIC_HOST__" },
{ "type": "request.headers", "op": "set", "target": { "key": "x-ferndesk-original-host" }, "args": "__PUBLIC_HOST__" }
]
},
{
"src": "__BASE_PATH__/_ferndesk",
"dest": "https://__FERNDESK_HOST__/_ferndesk?__bp=__BASE_PATH__",
"transforms": [
{ "type": "request.headers", "op": "set", "target": { "key": "x-ferndesk-base-path" }, "args": "__BASE_PATH__" },
{ "type": "request.headers", "op": "set", "target": { "key": "x-forwarded-host" }, "args": "__PUBLIC_HOST__" },
{ "type": "request.headers", "op": "set", "target": { "key": "x-ferndesk-original-host" }, "args": "__PUBLIC_HOST__" }
]
},
{
"src": "__BASE_PATH__/_ferndesk/(.*)",
"dest": "https://__FERNDESK_HOST__/_ferndesk/$1?__bp=__BASE_PATH__",
"transforms": [
{ "type": "request.headers", "op": "set", "target": { "key": "x-ferndesk-base-path" }, "args": "__BASE_PATH__" },
{ "type": "request.headers", "op": "set", "target": { "key": "x-forwarded-host" }, "args": "__PUBLIC_HOST__" },
{ "type": "request.headers", "op": "set", "target": { "key": "x-ferndesk-original-host" }, "args": "__PUBLIC_HOST__" }
]
},
{
"src": "__BASE_PATH__",
"dest": "https://__FERNDESK_HOST__/?__bp=__BASE_PATH__",
"transforms": [
{ "type": "request.headers", "op": "set", "target": { "key": "x-ferndesk-base-path" }, "args": "__BASE_PATH__" },
{ "type": "request.headers", "op": "set", "target": { "key": "x-forwarded-host" }, "args": "__PUBLIC_HOST__" },
{ "type": "request.headers", "op": "set", "target": { "key": "x-ferndesk-original-host" }, "args": "__PUBLIC_HOST__" }
]
},
{
"src": "__BASE_PATH__/(.*)",
"dest": "https://__FERNDESK_HOST__/$1?__bp=__BASE_PATH__",
"transforms": [
{ "type": "request.headers", "op": "set", "target": { "key": "x-ferndesk-base-path" }, "args": "__BASE_PATH__" },
{ "type": "request.headers", "op": "set", "target": { "key": "x-forwarded-host" }, "args": "__PUBLIC_HOST__" },
{ "type": "request.headers", "op": "set", "target": { "key": "x-ferndesk-original-host" }, "args": "__PUBLIC_HOST__" }
]
}
]
}The headers part turns off Vercel's rewrite caching on these paths, so a page requested before the setup was finished isn't cached as Not Found. Deploy to apply it.
Check that it works
Open https://www.yourcompany.com/help. Your help center should load with its styling, and links between articles should stay on your domain. If styles are missing right after setup, redeploy to clear Vercel's cache. If something is off, see Troubleshoot your help center.
To stop using the sub-folder, click Remove Subdirectory in Ferndesk and remove these entries from vercel.json.
For a subdomain instead, or for other hosts, see Connect a custom domain to your help center.