> ## Documentation Index
> Fetch the complete documentation index at: https://docs.truhuddle.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect an existing website’s /blog path

> Keep your main website and serve your blog under /blog with a Cloudflare Worker, workspace-specific proxy secret, verified DNS and HTTPS routing.

DNS routes whole hostnames, so it cannot route only `/blog`. The path option uses a Cloudflare Worker to forward blog requests while your main website stays at its existing host.

1. Choose the path option in the domain dialog and add its TXT record.
2. In your Cloudflare account, create a Worker and paste the complete **Copy worker** code generated by your dialog. The code already contains your hostname and upstream free address.
3. In the Worker’s settings, add a secret named `TRUHUDDLE_PROXY_KEY`. Its value is the **Copy proxy key** value from the dialog. Deploy the Worker.
4. Attach two Worker routes for your existing zone: `company.com/blog` and `company.com/blog/*`. The hostname must use Cloudflare’s proxy for those routes to run.
5. Keep other website paths routed to your existing origin. Return to TruHuddle and click **Check connection**.

```text theme={null}
Worker secret name: TRUHUDDLE_PROXY_KEY
Worker route 1: company.com/blog
Worker route 2: company.com/blog/*

Use the unique secret value and complete Worker code from your domain dialog.
```

This example shows the generated Worker’s structure. For your connection, copy the version from the dialog so both hostnames match your workspace.

```javascript theme={null}
// Customer Cloudflare Worker. Routes: company.com/blog and company.com/blog/*
// Add TRUHUDDLE_PROXY_KEY as a Worker secret using the key shown below.
export default {
  async fetch(request, env) {
    const url = new URL(request.url);
    if (url.hostname !== "company.com" || !(url.pathname === '/blog' || url.pathname.startsWith('/blog/'))) return fetch(request);
    const upstream = new URL(url);
    upstream.hostname = "your-workspace.truhuddle.link";
    upstream.protocol = 'https:';
    upstream.port = '';
    const headers = new Headers(request.headers);
    for (const name of ['cookie', 'authorization', 'host', 'x-truhuddle-public-host', 'x-truhuddle-gateway-key']) headers.delete(name);
    headers.set('x-truhuddle-proxy-host', url.hostname);
    headers.set('x-truhuddle-proxy-key', env.TRUHUDDLE_PROXY_KEY);
    const response = await fetch(upstream, { method: request.method, headers, body: ['GET', 'HEAD'].includes(request.method) ? undefined : request.body, redirect: 'manual', cf: { cacheTtl: 0, cacheEverything: false } });
    const output = new Response(response.body, response);
    output.headers.delete('set-cookie');
    output.headers.set('Cache-Control', 'private, no-store');
    return output;
  }
};

```

Cloudflare’s guides explain [Worker routes](https://developers.cloudflare.com/workers/configuration/routing/routes/) and [Worker secrets](https://developers.cloudflare.com/workers/configuration/secrets/) in more detail.

The generated Worker strips account cookies and authorization before forwarding public requests, supplies the workspace-specific proxy secret and disables page caching. Keep that secret in Worker secrets. Disconnecting or reconnecting can change the key, so update the Worker if the dialog gives you a replacement.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.