Skip to content

Threadseeker/docs-proxy-worker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

docs-proxy-worker

To hide our backend service hostname but expose the auto-generated API docs at the same time, Threadseeker uses Cloudflare Worker as a reverse proxy for the API docs. This repo provides you the worker soucre code we're using for doc.threadseeker.app.

Features

  • Display your OpenAPI document while hiding the real API hostnames
  • Proxy the OpenAPI.json request indiviually
  • Disallow bots to index by setting /robots.txt and injecting noindex into <head>

Setup

For the completed guide, visit Cloudflare Doc.

Create a new worker project:

npm create cloudflare@latest -- doc-proxy-worker
cd doc-proxy-worker

Copy worker.js and paste the content into src/index.js, and replace the API_HOST with your real backend hostname.

Development

npx wrangler dev

Deploy

To deploy the local worker to your Cloudflare account:

npx wrangler deploy

Complete the login steps and your worker will be avaliable on cloud.

About

Worker as a reverse proxy for your API docs

Topics

Resources

License

Stars

Watchers

Forks