utillyUtilly home
How it worksPricingFor WebflowFor WordPressFor AI-built apps
Log in
How it worksPricingFor WebflowFor WordPressFor AI-built appsLog in

GitBook docs at /docs, without losing the rest of your site.

GitBook can serve your docs at yourdomain.com/docs on its Ultimate and Enterprise plans. You enter the subdirectory in GitBook, then route /docs to the proxy URL it gives you. GitBook publishes recipes for Cloudflare, Vercel, and AWS. Two of them, followed as written on a domain that already serves a website, reach beyond /docs. This guide shows where, and what Google finds once the docs are live.

Published November 6, 2026. GitBook, Cloudflare, AWS, Vercel, and Google documentation and the live URLs below checked the same day.

route tableall routes live
yourdomain.comutillyreverse proxy/Your site/docsGitBook

Which GitBook plan do you need?

Ultimate or Enterprise. GitBook's pricing page marks the custom subdirectory as not included on Free and Essential. A custom domain such as docs.yourdomain.com starts on Essential, so the move from subdomain to subdirectory is also a plan change. Additional users cost $12 per user per month on annual billing.

Free

$0 per site/month

/docs: Not included

Essential

$65 per site/month ($79 billed monthly)

/docs: Not included

Ultimate

$249 per site/month ($299 billed monthly)

/docs: Included

Enterprise

Custom pricing

/docs: Included

Prices as of November 6, 2026, annual billing, per site. The proxy itself is not part of any plan: GitBook's subdirectory docs say you set things up in your website's backend first, then finalize in GitBook.

Where do GitBook's three recipes go wrong?

In the Cloudflare and AWS recipes, the proxy is attached to the whole domain instead of /docs. On a domain that hosts only the docs, that is harmless. On a domain with a marketing site, each recipe needs one change. Every catch below comes from the platform's own documentation.

Cloudflare Worker

GitBook's recipe

Deploy a Hello World Worker, paste GitBook’s script, then attach it under Domains & Routes as a Custom domain on the bare domain, without /docs.

The catch

Cloudflare’s docs say Custom Domains “point all paths of a domain or subdomain to your Worker.” The script never checks the prefix, so every page of your main site goes to GitBook.

The change

If the domain serves anything else, attach the Worker as a Route on yourdomain.com/docs* instead and add the prefix check below.

Vercel rewrites

GitBook's recipe

Two rewrites in vercel.json: /docs to the proxy URL, and /docs/:match* to the proxy URL plus the rest of the path.

The catch

The cleanest of the three, as long as your main site already deploys on Vercel and no other rewrite or route claims /docs first.

The change

None needed for routing. On caching, Vercel honors upstream cache headers on external rewrites for projects created on or after April 6, 2026; the GitBook responses we fetched sent max-age=0, must-revalidate.

CloudFront and Lambda@Edge

GitBook's recipe

A new distribution with your main site as the origin, the function on the default behavior, CachingDisabled and AllViewerExceptHostHeader, the function built in us-east-1.

The catch

AWS says the default behavior’s path pattern is * and cannot be changed. The function only rewrites /docs requests, but CachingDisabled now covers your whole main site.

The change

Add a /docs* cache behavior, attach the function and CachingDisabled there, and give the default behavior the cache policy your main site needs.

Sources for the catches: Cloudflare's Custom Domains page, which also says a Custom Domain cannot be created on a hostname that already has a CNAME record; Cloudflare's Routes page, which describes routes as Worker functionality added in front of your existing application server; and AWS's cache behavior settings, which say the default behavior's pattern is set to * and cannot be changed.

One detail in the AWS recipe is worth knowing before you debug: the function sets both Host and X-Forwarded-Host to the GitBook proxy host, not to your domain. Canonicals still come out right: fetched directly, with no forwarded headers at all, GitBook's proxy address returned a canonical naming the public gitbook.com/docs URL. The public address comes from the subdirectory entered in GitBook's settings, not from a header.

What does the Worker do to the rest of your site?

It cuts the first five characters off every path and sends the result to GitBook. We ran the target logic from GitBook's published script against four paths, then requested the mangled targets from GitBook's proxy:

RequestSent to GitBook asResult
/Docs home pageYour homepage is replaced by the docs
/pricing…/site_XXXXing404 “Invalid ID” from GitBook
/blog/post…/site_XXXX/postTreated as the docs page /post, 404 in our test
/docs/publish/seo…/site_XXXX/publish/seoCorrect

The script is fine when only /docs traffic reaches it. Two changes make sure that is true. Attach the Worker as a Route with the pattern yourdomain.com/docs*, which needs a proxied DNS record for the hostname, and add a prefix check so a path like /docsearch, which the route pattern also matches, falls through to your origin:

export default {
  fetch(request) {
    const SUBDIRECTORY = '/docs';
    const PROXY_URL = 'https://proxy.gitbook.site/sites/site_XXXX'; // from GitBook
    const url = new URL(request.url);

    // Anything outside /docs goes to your normal origin untouched.
    if (url.pathname !== SUBDIRECTORY && !url.pathname.startsWith(SUBDIRECTORY + '/')) {
      return fetch(request);
    }

    const target = PROXY_URL + url.pathname.slice(SUBDIRECTORY.length);
    const proxy = new URL(target.endsWith('/') ? target.slice(0, -1) : target);
    proxy.search = url.search;
    return fetch(new Request(proxy, request));
  }
};

On a Route, fetch(request) passes the request to the application server set in your Cloudflare DNS, as Cloudflare's Routes page describes. Everything after the check is GitBook's own code, unchanged.

What does Google find on a GitBook subdirectory?

A correct canonical on your domain, and a second, crawlable copy of every page on GitBook's proxy host. GitBook runs its own docs at gitbook.com/docs, so we fetched one page there, its proxy address, and the robots.txt and sitemap files around them:

URL fetchedstatuswhat it says
gitbook.com/docs/publish/seo200canonical gitbook.com/docs/publish/seo
proxy.gitbook.site/sites/site_p4Xo4/publish/seo200canonical gitbook.com/docs/publish/seo, robots “index, follow”
proxy.gitbook.site/robots.txt400“invalid proxy url for site”
gitbook.com/docs/robots.txt200Sitemap: gitbook.com/docs/sitemap.xml
gitbook.com/robots.txt302to www.gitbook.com/robots.txt, whose only Sitemap line is www.gitbook.com/sitemap.xml
www.gitbook.com/sitemap.xml200347 URLs, none under gitbook.com/docs

The canonical is right on both hosts, which matches GitBook's SEO page: canonical URLs are generated for you. The proxy copy is the part to watch. It answers with a 200 and index, follow, to a Googlebot user agent too, and the proxy host's robots.txt returns 400. Google's robots.txt specification treats a 4xx other than 429 as if no robots.txt existed, so nothing there limits crawling. What keeps the copy out of results is the canonical, which Google's canonicalization docs call “a hint, not a rule.” You cannot change the proxy host, so help the hint: link to /docs URLs everywhere and never paste the proxy URL anywhere public.

The sitemap rows show the second gap. GitBook writes /docs/robots.txt with a Sitemap line for /docs/sitemap.xml, but Google reads robots.txt only from the top level of a host. On gitbook.com the root file redirects to the marketing site's robots.txt, which names only the marketing sitemap, and that sitemap lists no docs URLs. GitBook may well have submitted the docs sitemap in Search Console, which nobody outside can see. On your own domain, put it where every crawler finds it.

Which two settings outside the proxy matter for SEO?

The Sitemap line in your root robots.txt, and permanent redirects for pages you move inside GitBook. Neither is part of the proxy, and both are easy to miss.

The root sitemap line

GitBook generates the sitemap; announcing it is your job. On a subdirectory, /docs/sitemap.xml is a sitemap index pointing to a sitemap-pages.xml file per section. Add one line to the robots.txt your main site serves:

Sitemap: https://yourdomain.com/docs/sitemap.xml

You can also submit it in Search Console under the property that already covers your domain. Our sitemaps and robots.txt guide covers the root file in detail.

Permanent redirects for moves

When you move or rename a page, GitBook creates a 307 from the old URL, per its redirects docs. A 307 is temporary. Google's redirects guide says that for temporary redirects the indexing pipeline doesn't use the redirect as a signal that the target should be canonical.

GitBook's site redirects offer a permanent 308, which GitBook sends to search engines and anonymous visitors so it “counts for SEO.” For a page you moved for good, add a permanent redirect for the old path, then check that the old URL answers 308.

How do you check it after launch?

Five requests, run in order from any terminal. The second is the one GitBook's recipes skip: it confirms the proxy left your main site alone.

  1. 01

    The docs answer at the subdirectory

    curl -sI https://yourdomain.com/docs/<page> | head -n 1

    A 200. A 404 here usually means the subdirectory in GitBook’s settings and the route on your proxy disagree.

  2. 02

    The rest of the site still belongs to your main origin

    curl -s https://yourdomain.com/pricing | grep -o "<title>[^<]*"

    Your own page title. A GitBook title or a 404 means the proxy is catching paths outside /docs.

  3. 03

    The canonical names your domain

    curl -s https://yourdomain.com/docs/<page> | grep -o '<link rel="canonical"[^>]*>'

    https://yourdomain.com/docs/<page>. GitBook builds it from the subdirectory you entered in its settings.

  4. 04

    The root robots.txt announces the docs sitemap

    curl -s https://yourdomain.com/robots.txt | grep -i sitemap

    A line for https://yourdomain.com/docs/sitemap.xml, next to your main sitemap.

  5. 05

    Pages you moved for good answer with a 308

    curl -sI https://yourdomain.com/docs/<old-path> | head -n 1

    308 for a permanent move. A 307 is GitBook’s automatic redirect, which Google treats as temporary.

Moving from docs.yourdomain.com? The old host needs page-level 301s to the new /docs URLs, and something has to keep answering on it to serve them. Whoever runs the route, a managed service like ours included, should be able to show you that only /docs reaches GitBook, and the second check above is how you confirm it.

Comparing docs tools?The same setup for Mintlify, which allows a subpath on its free plan.Leaving docs.yourdomain.com?Redirects, sitemaps, and the monitoring window for the move.Keeping the Worker yourself?The build-vs-buy comparison for Cloudflare Workers.How the managed route worksConnect, map the path, preview, one DNS change.

GitBook subdirectory FAQs

Can GitBook host docs at yourdomain.com/docs?

Yes. GitBook calls it a custom subdirectory. You enter the URL and subdirectory under Domain and redirects in the site settings, GitBook gives you a proxy URL, and you route the subdirectory to it from Cloudflare, Vercel, AWS, or another proxy you run.

Which GitBook plan includes a custom subdirectory?

As of November 6, 2026, GitBook’s pricing page lists the custom subdirectory on the Ultimate and Enterprise plans only, not on Free or Essential. Ultimate is $249 per site per month billed annually, or $299 billed monthly. GitBook’s free Community plan, for eligible non-profit, open-source, and education organizations, includes all Ultimate features except SAML SSO.

Will GitBook’s Cloudflare Worker break my main site?

It can, if you follow the recipe on a domain that serves other pages. The recipe attaches the Worker as a Custom Domain, which Cloudflare routes every path through, and the script does not check for /docs. Attach it as a Route on yourdomain.com/docs* and add a prefix check.

Does Google index proxy.gitbook.site as a duplicate of my docs?

It can reach it. On GitBook’s own docs, the proxy address returned 200 with robots “index, follow” and a canonical pointing at the public URL, and its robots.txt returned 400, which Google treats as no crawl restrictions. Google calls the canonical a hint, so link to your /docs URLs everywhere and keep the proxy address out of public links.

Where is the GitBook sitemap on a subdirectory?

At /docs/sitemap.xml, a sitemap index that points to sitemap-pages.xml files for each section. GitBook writes a Sitemap line for it into /docs/robots.txt, which Google does not read. Add the line to the robots.txt your main site serves at the root.

Is /docs better for SEO than docs.yourdomain.com?

GitBook’s own documentation says a subdirectory “may also be beneficial for SEO.” Google’s documentation does not say subfolders rank better, and docs on a subdomain can rank well. The case for /docs is keeping links and brand on one host. Our subdomain vs. subfolder guide covers both sides.

One domain for every platform.

Start a trial, map your first subfolder route, and preview it on your own domain before changing any DNS.

utilly

One domain for every site you run. Utilly reverse-proxies Webflow, WordPress, and AI-built apps into subfolders of your main domain.

Product

  • How it works
  • Pricing
  • Webflow Reverse Proxy
  • WordPress Reverse Proxy
  • Framer Reverse Proxy
  • Shopify Reverse Proxy

AI-built apps

  • Vibe-coded apps
  • Lovable on your domain
  • Bolt on your domain
  • Replit on your domain

Learn

  • Subdomain vs. subfolder
  • Webflow proxy setup guide
  • Subdomain migration guide
  • HubSpot blog on a subdirectory
  • Canonical tags behind a proxy
  • Ghost blog on a subdirectory
  • Mintlify docs at /docs
  • Sitemaps and robots.txt
  • GitBook docs at /docs
  • vs. Cloudflare Workers DIY
  • vs. self-hosted nginx

Legal

  • Privacy Policy
  • Refund Policy
  • Terms of Service

Get started

  • Log in
  • Start free trial

© 2026 Utilly. All rights reserved.

utilly.co/*