Socket
Book a DemoInstallSign in
Socket

cors-dev-proxy

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cors-dev-proxy

A minimal CLI helper to run a local development server with CORS enabled

latest
Source
npmnpm
Version
0.0.0
Version published
Maintainers
1
Created
Source

cors-dev-proxy

A minimal CLI helper to run a local development server with CORS enabled. Perfect for frontend development when you need to proxy requests to a backend server that doesn't have CORS configured.

Installation

npm install -g cors-dev-proxy
# or
pnpm add -g cors-dev-proxy
# or
yarn global add cors-dev-proxy

Usage

cors-dev-proxy [options] <command> [args...]

Options

  • -i, --in <port> - Specify the port of the backend server to proxy to
  • -o, --out <port> - Specify the port for the CORS proxy (default: 3000)

Examples

Start a server and automatically detect its port:

cors-dev-proxy npm run dev

Specify ports explicitly:

cors-dev-proxy -i 5173 -o 3000 npm run dev

Run with Vite:

cors-dev-proxy vite

Run with any command:

cors-dev-proxy -o 8080 node server.js

How it works

  • Spawns your command - Runs the specified command (e.g., your dev server)
  • Detects the port - Automatically detects which port your server is listening on
  • Creates a CORS proxy - Starts a proxy server that forwards requests with proper CORS headers
  • Forwards requests - All requests to the proxy are forwarded to your backend with CORS enabled

Features

  • Automatic port detection - No need to specify ports if your server outputs them
  • 🔄 WebSocket support - Proxies WebSocket connections too
  • 🎯 Credentials support - Handles cookies and authorization headers
  • 🚀 Zero configuration - Just wrap your existing dev command
  • 📦 Minimal dependencies - Lightweight and fast

CORS Headers

The proxy automatically adds:

  • Access-Control-Allow-Origin - Set to the request origin or *
  • Access-Control-Allow-Methods - Supports GET, POST, PUT, DELETE, OPTIONS
  • Access-Control-Allow-Headers - Allows all requested headers
  • Access-Control-Allow-Credentials - Enabled when cookies/auth are present

License

MIT © Viktor Lázár

Keywords

cors

FAQs

Package last updated on 13 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts