https://github.com/yqs112358/cfworkers-reverseproxy-withauth
Simple Reverse Proxy with Http Basic Auth via Cloudflare Workers
https://github.com/yqs112358/cfworkers-reverseproxy-withauth
basic-auth cloudflare cloudflare-workers http-basic-auth reverse-proxy
Last synced: 16 days ago
JSON representation
Simple Reverse Proxy with Http Basic Auth via Cloudflare Workers
- Host: GitHub
- URL: https://github.com/yqs112358/cfworkers-reverseproxy-withauth
- Owner: yqs112358
- Created: 2024-12-05T13:21:01.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2024-12-05T13:22:28.000Z (6 months ago)
- Last Synced: 2025-05-05T15:02:48.015Z (17 days ago)
- Topics: basic-auth, cloudflare, cloudflare-workers, http-basic-auth, reverse-proxy
- Language: JavaScript
- Homepage:
- Size: 32.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple Reverse Proxy with Http-Basic Auth via Cloudflare Workers
> Forked from https://github.com/dommmel/cloudflare-workers-basic-auth and add simple reverse proxy
## Attention!
Never create reverse proxy on Cloudflare Workers **without auth protection**!- Services without auth may be abused, and then lead to your CloudFlare account being locked.
- Use this project to protect your reverse proxy behind http-basic auth.## Usage
1. Create a new CloudFlare worker
2. Copy the code from [index.js](https://github.com/yqs112358/CFWorker-BasicAuth-Reverse-Proxy/blob/master/index.js) to CloudFlare worker's code editor
3. Set reverse parameters at the top of `index.js`
```javascript
const SECRET = "your-secret"; // Set your secret key
const HOST_NAME = "target-website.com"; // Set target hostname you want to proxy (For example: "somewebsite.com" / "anotherwebsite.net:12345")
const SUB_PATH = "/"; // Set the sub-path you want to proxy ("/" in default)
```
4. Save and deploy your CloudFlare worker
5. Visit `https://[email protected]` to pass http-basic auth and access target website through proxy