local-ssl-proxy is a lightweight utility designed to create an HTTPS proxy for local development. It leverages a self-signed SSL certificate, allowing developers to access local HTTP servers over HTTPS. This functionality is critical for testing applications that require a secure context, such as those using OAuth, secure cookies, geolocation APIs, or needing to avoid mixed-content warnings. The current stable version is 2.0.5, last updated in March 2023. While specific release cadence isn't formalized, updates typically address dependencies or minor enhancements. Its primary differentiators are its ease of use via the command line for quick setup, support for custom certificates (e.g., generated by `mkcert` for a trusted browser experience), and the ability to manage multiple proxy configurations through a single file, making it a flexible choice for diverse local development workflows. It is strictly intended for local development and should never be used in production environments.
npm install local-ssl-proxyVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to programmatically start `local-ssl-proxy` to proxy HTTPS traffic from port 9001 to an underlying HTTP server on port 3000. It also shows the equivalent CLI command. This setup is ideal for local development and requires pre-generated `mkcert` certificates for a trusted experience.
Refer to the `local-ssl-proxy` GitHub repository or npm page for specific version documentation. It is generally recommended to use the latest stable version and update your scripts accordingly.
To avoid browser warnings, install `mkcert` (e.g., `brew install mkcert` on macOS, `choco install mkcert` on Windows), run `mkcert -install`, and then `mkcert localhost`. Configure `local-ssl-proxy` to use these generated `localhost.pem` and `localhost-key.pem` files with the `--cert` and `--key` flags.
NEVER use `local-ssl-proxy` in production. For production HTTPS, always use professionally issued certificates from trusted Certificate Authorities (e.g., Let's Encrypt) and dedicated reverse proxies like Nginx or Caddy.
Always refer to the official documentation for the correct config file schema. An example structure includes objects where keys are proxy names, and values are objects with `source`, `target`, `key`, `cert`, and `hostname` properties.
Accept the warning and proceed (for temporary testing) or, for a better development experience, use `mkcert` to generate locally trusted certificates and configure `local-ssl-proxy` to use them.
Choose a different available port for the `source` or `target` (e.g., `--source 9443` or `--target 8000`). You can identify the process using the port with `lsof -i :<port>` on Unix-like systems or `netstat -ano | findstr :<port>` on Windows.
Ensure your HTTP application is actively running and listening on the `target` port specified for `local-ssl-proxy`. Check your firewall settings to allow traffic on both the `source` and `target` ports.