A Full-Featured HTTP and WebSocket Proxy for Node.js forked from http-party/node-http-proxy with modern Typescript rewrite.
Install package:
# npm
npm install httpxy
# yarn
yarn add httpxy
# pnpm
pnpm install httpxy
Create proxy:
import { createServer } from "node:http";
import { createProxyServer } from "httpxy";
const proxy = createProxyServer({});
createServer((req, res) => {
proxy.web(req, res, {
target: "http://example.com",
headers: { host: "example.com" },
});
}).listen(3000, () => {
console.log("Proxy is listening on http://localhost:3000");
});
Checkout http-party/node-http-proxy for more options and examples.
- Clone this repository
- Install latest LTS version of Node.js
- Enable Corepack using
corepack enable
- Install dependencies using
pnpm install
- Run interactive tests using
pnpm dev
Made with 💛
Published under MIT License.