https://github.com/threadseeker/docs-proxy-worker
Worker as a reverse proxy for your API docs
https://github.com/threadseeker/docs-proxy-worker
cloudflare-workers javascript
Last synced: 4 months ago
JSON representation
Worker as a reverse proxy for your API docs
- Host: GitHub
- URL: https://github.com/threadseeker/docs-proxy-worker
- Owner: Threadseeker
- License: apache-2.0
- Created: 2025-02-07T14:16:22.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-07T14:29:54.000Z (over 1 year ago)
- Last Synced: 2025-02-07T15:24:40.947Z (over 1 year ago)
- Topics: cloudflare-workers, javascript
- Language: JavaScript
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# docs-proxy-worker
To hide our backend service hostname but expose the auto-generated API docs at the same time, [Threadseeker](https://threadseeker.app) uses [Cloudflare Worker](https://workers.cloudflare.com/) as a reverse proxy for the API docs. This repo provides you the worker soucre code we're using for [doc.threadseeker.app](https://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 ``
## Setup
For the completed guide, visit [Cloudflare Doc](https://developers.cloudflare.com/workers/get-started/guide/).
Create a new worker project:
```bash
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
```bash
npx wrangler dev
```
## Deploy
To deploy the local worker to your Cloudflare account:
```bash
npx wrangler deploy
```
Complete the login steps and your worker will be avaliable on cloud.