https://github.com/treeder/reverse-proxy
A simple, modern JavaScript reverse-proxy that has no dependencies and only uses the JavaScript standard library. Works on all major JS platforms.
https://github.com/treeder/reverse-proxy
Last synced: 4 months ago
JSON representation
A simple, modern JavaScript reverse-proxy that has no dependencies and only uses the JavaScript standard library. Works on all major JS platforms.
- Host: GitHub
- URL: https://github.com/treeder/reverse-proxy
- Owner: treeder
- Created: 2025-01-21T18:19:59.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-31T21:29:44.000Z (over 1 year ago)
- Last Synced: 2025-01-31T22:26:17.218Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# reverse-proxy
A simple, modern JavaScript reverse-proxy that has no dependencies and only uses the JavaScript standard library.
Also works for all major JS platforms.
## Set destination URL in environment
```
PROXY_URL=https://wherever.com
PROXY_KEY=SOME_SECRET_STRING
```
If you have the `PROXY_KEY` set (optional), then the request must include one of the following
that matches:
- `X-Proxy-Key` header
- `proxyKey` query param
## Node
```sh
node --env-file=.env node.js
```
## Bun
```sh
NODE_TLS_REJECT_UNAUTHORIZED=0 bun bun.js
```
## Cloudflare workers
TODO: make docs for this.
Use `worker.js`
## To run on a VPS and have it run forever
Install [pm2](https://github.com/Unitech/pm2):
```sh
npm install -g pm2
```
Then start this with:
```sh
pm2 start node.js
```
To run it with bun:
```sh
pm2 start --interpreter ~/.bun/bin/bun bun.js
```