https://github.com/cameronhunter/local-ssl-proxy
Simple SSL HTTP proxy using a self-signed certificate. Intended for local development only.
https://github.com/cameronhunter/local-ssl-proxy
Last synced: about 1 year ago
JSON representation
Simple SSL HTTP proxy using a self-signed certificate. Intended for local development only.
- Host: GitHub
- URL: https://github.com/cameronhunter/local-ssl-proxy
- Owner: cameronhunter
- License: mit
- Created: 2013-02-07T08:26:32.000Z (over 13 years ago)
- Default Branch: main
- Last Pushed: 2023-10-02T23:05:35.000Z (over 2 years ago)
- Last Synced: 2024-05-17T07:02:18.603Z (about 2 years ago)
- Language: TypeScript
- Size: 1.7 MB
- Stars: 660
- Watchers: 9
- Forks: 64
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# local-ssl-proxy
[](https://github.com/cameronhunter/prettier-package-json/actions/workflows/ci.yml) [](https://npmjs.org/package/local-ssl-proxy) [](https://github.com/cameronhunter/local-ssl-proxy/blob/master/LICENSE.md)
Simple SSL HTTP proxy using a self-signed certificate. Intended for local development only.
## Quick Start
The package supports immediate use via [`npx`](https://docs.npmjs.com/cli/v7/commands/npx) or you can install it
globally.
Use via `npx`:
```sh
npx local-ssl-proxy
```
Install globally:
```sh
npm install -g local-ssl-proxy
```
## Usage
To start a proxy from port `9001` to `9000` run:
```sh
local-ssl-proxy --source 9001 --target 9000
```
Start your web server on the target port (`9000` in the example) and navigate to `https://localhost:` ([https://localhost:9001](https://localhost:9001) in the example). You'll get a warning because the certificate is self-signed, this is safe to ignore during development.
Using a dynamic DNS provider such as [noip](http://www.noip.com/personal/) or [DynDNS](http://dyn.com/dns/) or a static IP (if you have one) you can open a port in your firewall to allow external sites to call into your web server. This is great for developing applications using [OAuth](http://oauth.net/) without having to deploy externally.
## Advanced
You can also pass a configuration file, this helps share setups with team members. These can contain multiple proxies that `local-ssl-proxy` will open concurrently.
Example config:
```json
{
"My proxy": {
"source": 3001,
"target": 3000,
"key": "localhost-key.pem",
"cert": "localhost.pem",
"hostname": "localhost"
},
"Another proxy": {
"source": 9999,
"target": 9000,
"key": "localhost-key.pem",
"cert": "localhost.pem",
"hostname": "localhost"
}
}
```
And run the proxy with the configuration file:
```sh
local-ssl-proxy --config config.json
```
## Run SSL proxy with a self-signed trusted certificate
You can use it to host any domain, just change localhost to anything you like, wildcards are also supported.
1. Install [mkcert](https://github.com/FiloSottile/mkcert) (`choco install mkcert` / `brew install mkcert`)
1. Run `mkcert -install`
1. Run `mkcert localhost`
1. Run
```sh
local-ssl-proxy --key localhost-key.pem --cert localhost.pem --source 9001 --target 9000
```
1. You're all set! Just go to https://localhost:9001 and see your project working!