local-cors-proxy-bun
v1.0.0
Published
A lightweight CORS proxy for local development, powered by Bun
Maintainers
Readme
local-cors-proxy-bun
A Bun CORS proxy for local development.
Install
bun add local-cors-proxy-bunCLI
bunx local-cors-proxy-bun --port 8010 --origin "*" --credentials| Flag | Short | Default | Description |
| --------------- | ----- | ------- | ------------------------------------------ |
| --port | -p | 8010 | Port to listen on |
| --origin | -o | * | Access-Control-Allow-Origin value |
| --credentials | -c | false | Include Access-Control-Allow-Credentials |
Environment variables (PORT, ORIGIN, CREDENTIALS) work too — flags take priority.
Programmatic
import { createProxy } from "local-cors-proxy-bun";
const server = createProxy({ port: 8010, origin: "*", credentials: false });
// server is a Bun.Server instance
server.stop();Usage
https://localhost:{port}/{encoded URL to proxy}
Prefix any encoded URL with the proxy address.
The proxy strips host, origin, and referer headers, follows redirects, and adds CORS headers to the response.
e.g.
http://localhost:8010/https%3A%2F%2Fapi.example.com%2Fdata