local-dev-proxy
v0.5.14
Published
Serve multiple local servers on ports 80/443 at the same time, with HTTPS support
Downloads
740
Maintainers
Readme
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.
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',
},
};
3. Run
package.json
"scripts": {
"start": "ldprx your-run-command"
}
Or
$ npx ldprx your-run-command