0.5.14 • Published 11 months ago

local-dev-proxy v0.5.14

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

npm.io npm.io

Local Dev Proxy

A proxy server to assist with running multiple server services simultaneously on ports 80 (HTTP) and 443 (HTTPS) in a local development environment.

npm.io npm.io npm.io npm.io

Overview

Managing multiple servers during local development can be challenging. Often, you might want to run multiple servers simultaneously on port 80. Local Dev Proxy addresses this issue by dynamically registering local servers and routing requests to the appropriate server based on predefined configurations.

Key Features

  • Access multiple local servers simultaneously on ports 80 and 443.
  • Route requests to the appropriate local server based on host or path configuration.
  • Automatically register host in the /etc/hosts file
  • HTTPS support:
    • Automatically issues and applies certificates for local domains.

Components

Server

  • A Docker server acting as a proxy.
  • Occupies ports 80/443.
  • Registers/unregisters local servers via an API.
  • Routes requests to the target server based on registered rules.

Launcher

  • Located within each project as a library.
  • Runs the proxy server (if not already running).
  • Registers the port occupied by the currently running process with the server.
  • Configures host information through a configuration file.
  • Handles additional processing if host configuration is missing.

Flow

Quick Start

1. Installation

# If not installed as optional, errors may occur during npm install on Linux servers, etc.
$ npm install local-dev-proxy --optional

2. Configure the Configuration File

Create a .ldprxrc.js file in the project root and add the following content:

If your package is an ESModule, use .ldprxrc.cjs instead.

/** @type {import('local-dev-proxy').LocalDevProxyOption} */
module.exports = {
  rule: {
    key: 'sample-key',
    host: 'simple.local.your-domain.com',
  },
};

Configuration File Samples

3. Run

package.json

"scripts": {
  "start": "ldprx your-run-command"
}

Or

$ npx ldprx your-run-command

Example App

0.5.14

11 months ago

0.5.13

12 months ago

0.5.12

1 year ago

0.5.11

1 year ago

0.5.10

1 year ago

0.5.9

1 year ago

0.5.8

1 year ago

0.5.7

1 year ago

0.5.6

1 year ago