Host documentation at a /docs subpath using Cloudflare Workers
Workers & Pages > Create application > Create worker
. You
should be presented with the following screen where you can create a new
Cloudlfare worker.
Configure worker
. Navigate to the worker
Settings > Triggers
. Click on Add Custom Domain
to add your desired domain
into the list - we recommend you add both the version with and without www.
prepended to the domain.
Edit Code
and add the following script into the worker’s code.
DOCS_URL
by replacing [SUBDOMAIN]
with your unique subdomain and
CUSTOM_URL
with your website’s base URL.Deploy
and wait for the changes to propagate (it can take up to a few
hours).