Follow this guide to host your Ferndesk help center at a custom subfolder (like yourdomain.com/help) using Cloudflare Workers as a reverse proxy.
This takes approximately 10 minutes to do and requires little technical knowledge. We've written it to be as easy to follow as possible.
Getting stuck? Contact [email protected] and we'll help you complete your setup.
Prerequisites
A Ferndesk workspace with admin access
A domain you own (already pointed to Cloudflare)
Basic familiarity with Cloudflare's dashboard
Cloudflare's free plan allows 100,000 Worker requests per day. For production help centers with high traffic, consider upgrading to a paid plan with pay-per-use billing.
Step 1: Set up the custom subfolder in Ferndesk
First, configure your Ferndesk help center to use a custom subfolder path.
Log in to your Ferndesk workspace and navigate to Customize in the left sidebar.
Click Custom domain
Select the Custom sub-folder option (marked as Recommended).
Enter your domain in the Domain field (e.g.,
yourdomain.com).Enter your desired subfolder path in the Subdirectory field (e.g.,
/helpor/docs).Click Configure sub-folder.
Once configured, Ferndesk will generate the necessary DNS records and endpoint information. Note these details—you'll use them when setting up the reverse proxy.
Step 2: Create a Cloudflare Worker
Now create a new Cloudflare Worker that will act as a reverse proxy.
Log in to your Cloudflare dashboard.
Under BUILD → Compute & AI, navigate to Workers & Pages from the left sidebar .
Click Create application in the top right corner.
Under Start with Hello World!, click Get started.
Name your Worker something descriptive like
ferndesk-reverse-proxy, then click Deploy.
Step 3: Configure the worker routes
Set up the routing rule that directs traffic from your custom subfolder to the Cloudflare Worker.
In the Worker settings, navigate to the Settings tab.
Scroll to Domains & Routes and click Add.
A modal window will open. Select the Route option.
In the Zone dropdown, select your domain (e.g.,
yourdomain.com).In the Route field, enter the pattern for your subfolder path. Use
*yourdomain.com/help*to capture all requests to the/helppath and its subpaths.Leave Failure mode set to Fail closed (block) for security.
Click Add route.
IMPORTANT: You need to add a separate route for the ferndesk assets directory _ferndesk. Follow the steps below to complete your setup.
Step 3b: Adding the _ferndesk route
Scroll to Domains & Routes and click Add.
A modal window will open. Select the Route option.
In the Zone dropdown, select your domain (e.g.,
yourdomain.com).In the Route field, enter the pattern for your subfolder path. Use
*yourdomain.com/_ferndesk*to capture all requests to the/_ferndeskpath and its subpaths.Leave Failure mode set to Fail closed (block) for security.
Click Add route.
Step 4: Edit the Worker code
Now update the Worker code to handle the reverse proxy logic. The Worker will intercept requests to your subfolder and forward them to Ferndesk.
Click Edit code (or access the code editor from the Worker dashboard).
Replace the entire
worker.jscode with the reverse proxy script below.// ONLY edit these const HELP_HOST = 'your-slug.hc.ferndesk.com'; // your Ferndesk help center host copied from your dashboard const PROXY_PREFIX = '/help'; // the path you want your help center to live on addEventListener('fetch', (event) => { event.respondWith(handleRequest(event.request)); }); async function handleRequest(request) { const originalUrl = new URL(request.url); if (originalUrl.pathname.endsWith('/') && originalUrl.pathname !== '/') { originalUrl.pathname = originalUrl.pathname.slice(0, -1); return Response.redirect(originalUrl.toString(), 301); } if ( originalUrl.pathname !== PROXY_PREFIX && !originalUrl.pathname.startsWith(`${PROXY_PREFIX}/`) && !originalUrl.pathname.startsWith('/_ferndesk/') ) { return fetch(request); } // Build the upstream request with the prefix removed const upstreamUrl = new URL(originalUrl.toString()); upstreamUrl.hostname = HELP_HOST; if (upstreamUrl.pathname === PROXY_PREFIX) { upstreamUrl.pathname = '/'; } else if (upstreamUrl.pathname.startsWith(`${PROXY_PREFIX}/`)) { upstreamUrl.pathname = upstreamUrl.pathname.slice(PROXY_PREFIX.length) || '/'; } const proxyRequest = new Request(upstreamUrl.toString(), request); // CRITICAL: Needed to resolve requests correctly proxyRequest.headers.set('X-Ferndesk-Base-Path', PROXY_PREFIX); proxyRequest.headers.set('X-Forwarded-Host', originalUrl.host); proxyRequest.headers.set('X-Ferndesk-Original-Host', originalUrl.host); return fetch(proxyRequest); }Replace
HELP_HOSTwith the actual Ferndesk domain provided when you configured your custom subfolder. ReplacePROXY_PREFIXif you're using a different subfolder path (e.g.,/docsinstead of/help).Click Deploy to publish your changes.
Step 5: Verify the setup
Test that your help center is now accessible at your custom subfolder path.
Open a new browser tab and navigate to
https://yourdomain.com/help.You should see your Ferndesk help center loaded with your branding.
Test a few pages by clicking links to ensure navigation works correctly.
If your help center loads successfully and displays your content, the reverse proxy is working correctly! Your customers can now access your help center at your custom domain.
Something went wrong? Contact us at [email protected] and we'll help you complete your setup.
Troubleshooting
Issue | Cause | Solution |
|---|---|---|
404 Not Found error when visiting the URL | Route is not configured correctly or the Worker is not deployed | Verify the route pattern matches your domain and subfolder path exactly. Check that the Worker is deployed and active in the Domains & Routes section. |
Blank page or broken styling | Ferndesk domain in Worker code is incorrect | Double-check the |
CSS and images not loading | Relative URLs in the Ferndesk response aren't being rewritten | You may need to add response header rewriting to handle relative assets. Contact Ferndesk support for advanced proxy configuration. |
Worker requests limited to 100,000/day | Cloudflare free plan rate limit reached | Upgrade your Cloudflare plan to pay-per-use billing for unlimited requests beyond the free tier. |