> ## Documentation index
> Fetch the complete documentation index at: https://workover.io/docs/llms.txt

# Proxy setups by platform

The exact configuration to serve your Help Center at a path of your own website, for Cloudflare, Vercel, Next.js, AWS CloudFront, AWS Amplify, Netlify, nginx, Caddy and Apache.

When your Help Center is served under a path of your website, like `example.com/docs`, your website forwards that path to Workover. This page has the setup for each platform. In the project's **Domain** settings, Workover shows the same setup with your own domain, path and host already filled in, and starts with the platform your website runs on, which it reads from your site's response headers.

The examples below use `example.com/docs` and the host `example-com-1a2b3c4d.workover.site`. Copy yours from **Domain**, not from here: the host is different for every Help Center.

## What every setup does

1. It sends `/docs` and every path under it to your Help Center's host, with the path unchanged. Nothing else on your site is affected.
2. It names your domain in a request header, which is what lets search engines index the pages. Workover accepts any one of these:
  - `X-Forwarded-Host: example.com`
  - `X-Workover-Host: example.com`, a fixed header that any proxy can add with one line
  - `Forwarded: host=example.com`
  Workover trusts the header only for the domain you proved with the TXT record. Without one, every page is sent with `noindex`, and nothing else fails to tell you, which is why **Check the live site** exists.
3. It holds no secret. The host is public.

Every page, image, stylesheet and script of the Help Center is under `/docs`, so there is no other path to forward.

## Have an agent add it

If your website's code is in a repository, an agent can add the setup there:

```sh
workover site proxy --project <projectId> --write
```

It detects where your site runs, or takes `--platform cloudflare|vercel|nextjs|cloudfront|amplify|netlify|nginx|caddy|apache`. It merges the two rules into `vercel.json` or `netlify.toml`, first, and writes the Worker, nginx, Caddy and Apache setups as files of their own to include. It prints the Next.js, CloudFront and Amplify setups instead, since those go inside code or a console. The MCP server's `workover_proxy_setup` tool returns the same setup.

## Cloudflare

Create a Worker with this script, and add two routes to it: example.com/docs and example.com/docs/*. Do not use example.com/docs*, which would also match paths like /docs-audit.

```js
export default {
  async fetch(request) {
    const url = new URL(request.url);
    const target = new URL(url.pathname + url.search, 'https://example-com-1a2b3c4d.workover.site');
    const headers = new Headers(request.headers);
    headers.set('X-Forwarded-Host', 'example.com');
    headers.set('X-Forwarded-Proto', 'https');
    return fetch(target, {
      method: request.method,
      headers,
      body: ['GET', 'HEAD'].includes(request.method) ? undefined : request.body,
      redirect: 'manual'
    });
  }
};
```

The Worker names your domain in `X-Forwarded-Host`. If your site is on Cloudflare but served by Vercel or Next.js, either setup works.

## Vercel

Merge this into vercel.json. Only /docs and the paths under it go to Workover, and Vercel names your domain in X-Forwarded-Host itself.

```json
{
  "rewrites": [
    {
      "source": "/docs",
      "destination": "https://example-com-1a2b3c4d.workover.site/docs"
    },
    {
      "source": "/docs/:path*",
      "destination": "https://example-com-1a2b3c4d.workover.site/docs/:path*"
    }
  ]
}
```

Vercel sends `X-Forwarded-Host` with the visitor’s domain on its own, so the rewrite needs nothing else.

> **Note:** Workover has not yet run this setup end to end itself. **Check the live site** tells you whether it works for yours.

## Next.js

For a Next.js site you run yourself (on Vercel, either this or the Vercel setup works). Merge the rewrites into next.config.js; Next.js names your domain in X-Forwarded-Host itself. If your rewrites() already returns a list, put these two first in it.

```js
// next.config.js: merge into your config. beforeFiles runs before your own pages and routes.
module.exports = {
  async rewrites() {
    return {
      beforeFiles: [
        { source: '/docs', destination: 'https://example-com-1a2b3c4d.workover.site/docs' },
        { source: '/docs/:path*', destination: 'https://example-com-1a2b3c4d.workover.site/docs/:path*' }
      ]
    };
  }
};
```

Next.js forwards the request with `X-Forwarded-Host` set to the visitor’s domain, as Vercel does.

## AWS CloudFront

Add an origin and two behaviours to the distribution that serves example.com. The origin sends the fixed header X-Workover-Host: example.com, so no function is needed.

In the AWS console:

1. Origins → Create origin. Origin domain: example-com-1a2b3c4d.workover.site. Protocol: HTTPS only. Add custom header: X-Workover-Host = example.com.
2. Behaviors → Create behavior, twice: path pattern /docs, then /docs/\*. Origin: the one above. Viewer protocol: Redirect HTTP to HTTPS. Allowed methods: GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE. Cache policy: CachingDisabled. Origin request policy: AllViewerExceptHostHeader.
3. Move both behaviours above Default (\*), and any other behaviour that could match /docs.

Or in OpenTofu or Terraform:

```hcl
# OpenTofu or Terraform. The two data sources go next to your aws_cloudfront_distribution;
# the origin and both behaviours go inside it, with the behaviours above any other
# ordered_cache_behavior so they match first.

data "aws_cloudfront_cache_policy" "workover_docs" {
  name = "Managed-CachingDisabled"
}

data "aws_cloudfront_origin_request_policy" "workover_docs" {
  name = "Managed-AllViewerExceptHostHeader"
}

# Inside resource "aws_cloudfront_distribution":

origin {
  origin_id   = "workover-docs"
  domain_name = "example-com-1a2b3c4d.workover.site"

  custom_origin_config {
    http_port              = 80
    https_port             = 443
    origin_protocol_policy = "https-only"
    origin_ssl_protocols   = ["TLSv1.2"]
  }

  custom_header {
    name  = "X-Workover-Host"
    value = "example.com"
  }
}

ordered_cache_behavior {
  path_pattern             = "/docs"
  target_origin_id         = "workover-docs"
  viewer_protocol_policy   = "redirect-to-https"
  allowed_methods          = ["GET", "HEAD", "OPTIONS", "PUT", "POST", "PATCH", "DELETE"]
  cached_methods           = ["GET", "HEAD"]
  compress                 = true
  cache_policy_id          = data.aws_cloudfront_cache_policy.workover_docs.id
  origin_request_policy_id = data.aws_cloudfront_origin_request_policy.workover_docs.id
}

ordered_cache_behavior {
  path_pattern             = "/docs/*"
  target_origin_id         = "workover-docs"
  viewer_protocol_policy   = "redirect-to-https"
  allowed_methods          = ["GET", "HEAD", "OPTIONS", "PUT", "POST", "PATCH", "DELETE"]
  cached_methods           = ["GET", "HEAD"]
  compress                 = true
  cache_policy_id          = data.aws_cloudfront_cache_policy.workover_docs.id
  origin_request_policy_id = data.aws_cloudfront_origin_request_policy.workover_docs.id
}
```

CloudFront sends Workover’s host as `Host` (that is what `AllViewerExceptHostHeader` does) and your domain in the fixed origin header `X-Workover-Host`, so no CloudFront Function or Lambda@Edge is needed. Caching is off for these two behaviours: the Help Center sets its own cache headers, and a publish shows up within a minute. The data sources look the managed policies up by name, so there are no ids to copy.

> **Note:** Workover has not yet run this setup end to end itself. **Check the live site** tells you whether it works for yours.

## AWS Amplify

In the Amplify console: Hosting → Rewrites and redirects → Manage redirects → Open text editor, and put these two rules first. Amplify cannot add a request header, so whether search engines may index the pages depends on what Amplify forwards: check the live site once it is in. For indexable docs, put CloudFront in front with the CloudFront setup.

```json
[
  {
    "source": "/docs",
    "target": "https://example-com-1a2b3c4d.workover.site/docs",
    "status": "200"
  },
  {
    "source": "/docs/<*>",
    "target": "https://example-com-1a2b3c4d.workover.site/docs/<*>",
    "status": "200"
  }
]
```

Amplify Hosting proxies with a `200` rewrite but cannot add a request header. Readers see your docs; whether search engines may index them depends on what Amplify forwards. Run **Check the live site** to find out. For indexable docs on AWS, put a CloudFront distribution in front with the CloudFront setup.

> **Note:** Workover has not yet run this setup end to end itself. **Check the live site** tells you whether it works for yours.

## Netlify

Add these to netlify.toml, above any other redirect that could match /docs (a single-page app's /\* rule, say).

```toml
[[redirects]]
  from = "/docs"
  to = "https://example-com-1a2b3c4d.workover.site/docs"
  status = 200
  force = true
  headers = { X-Workover-Host = "example.com" }

[[redirects]]
  from = "/docs/*"
  to = "https://example-com-1a2b3c4d.workover.site/docs/:splat"
  status = 200
  force = true
  headers = { X-Workover-Host = "example.com" }
```

Netlify adds the `X-Workover-Host` header to the proxied request. `force = true` sends the path to Workover even where your site has a file of the same name.

> **Note:** Workover has not yet run this setup end to end itself. **Check the live site** tells you whether it works for yours.

## nginx

Add both locations to the server block for example.com, then reload nginx (nginx -t && nginx -s reload).

```nginx
# Inside the server { } block for example.com. ^~ keeps your own regex locations
# (for .css or .js files, say) from taking the docs' assets.
location = /docs {
    proxy_pass https://example-com-1a2b3c4d.workover.site;
    proxy_http_version 1.1;
    proxy_set_header Host example-com-1a2b3c4d.workover.site;
    proxy_set_header X-Workover-Host example.com;
    proxy_set_header X-Forwarded-Proto https;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_ssl_server_name on;
    proxy_ssl_name example-com-1a2b3c4d.workover.site;
    proxy_redirect off;
}

location ^~ /docs/ {
    proxy_pass https://example-com-1a2b3c4d.workover.site;
    proxy_http_version 1.1;
    proxy_set_header Host example-com-1a2b3c4d.workover.site;
    proxy_set_header X-Workover-Host example.com;
    proxy_set_header X-Forwarded-Proto https;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_ssl_server_name on;
    proxy_ssl_name example-com-1a2b3c4d.workover.site;
    proxy_redirect off;
}
```

`^~` keeps your own regular-expression locations (for `.css` or `.js` files, say) from taking the Help Center’s assets. `proxy_ssl_server_name on` is required: without it nginx sends no server name and the connection is refused.

## Caddy

Add this to the site block for example.com in your Caddyfile, then reload Caddy (caddy reload).

```caddyfile
# Inside the site block for example.com, above your other handle blocks.
@workover_docs path /docs /docs/*
handle @workover_docs {
	reverse_proxy https://example-com-1a2b3c4d.workover.site {
		header_up Host {upstream_hostport}
		header_up X-Workover-Host example.com
	}
}
```

Caddy sends `X-Forwarded-Host` itself as well, so either header reaches Workover.

## Apache

Add this to the VirtualHost for example.com, then reload Apache (apachectl configtest && apachectl graceful).

```apache
# Inside the <VirtualHost> for example.com.
# Needs mod_proxy, mod_proxy_http, mod_ssl and mod_headers (a2enmod proxy proxy_http ssl headers).
SSLProxyEngine on
ProxyPreserveHost Off
ProxyPassMatch "^(/docs(?:/.*)?)$" "https://example-com-1a2b3c4d.workover.site$1"
ProxyPassReverse "/docs" "https://example-com-1a2b3c4d.workover.site/docs"
<LocationMatch "^/docs(/|$)">
    RequestHeader set X-Workover-Host "example.com"
</LocationMatch>
```

The match covers the path and everything under it, but not other paths that start the same way, like `/docs-audit`.

## Then check it

1. In **Domain**, click **Check the live site**, or run `workover site check --project <projectId>`. Workover loads `https://example.com/docs` the way a reader and a search engine do, and says whether the Help Center answered and whether it may be indexed there. When something is wrong, it says what to change on your platform.
2. Add this line to your domain's own `robots.txt`, the only one crawlers read on your domain:
  ```
  Sitemap: https://example.com/docs/sitemap.xml
  ```

## Related

- [Serve it under a path](https://workover.io/docs/help-center/serve-under-a-path)
- [Connect a custom domain](https://workover.io/docs/help-center/custom-domain)
