Skip to content

Commit

Permalink
docs: Add docs for HTTPS and SSL in README
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiogc9 committed Aug 9, 2023
1 parent db9ec61 commit 7cd939c
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions packages/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,35 @@ const server = new ProxyServer({
server.start();
```

#### HTTPS and SSL certificates

The server supports HTTPS enabling the option `enableHTTPS` with **multiple domains**. It is fully compatible with [LetsEncrypt](https://letsencrypt.org/) and [certbot](https://certbot.eff.org/) but also with custom SSL certificates.

Once HTTPS is enabled, the server detects the domain in each request and tries to find a SSL certificate. If the certificate does not exist, it uses an untrusted temporary SSL certificate valid for 1 day.

Valid SSL certificates must be provided, using LetsEncrypt or another provider.

##### Using LetsEncrypt

Install the `certbot` following the instructions [here](https://certbot.eff.org/instructions). Then run the server with the `enableHTTPS` option as `true` and with the `port` set to `443`.

When the server is running, just add the certificate into the server:

```bash
sudo certbot certonly --webroot --keep-until-expiring --agree-tos -w $ABSOLUTE_PATH/letsencrypt -d DOMAIN
```

The server automatically adds the necessary routes needed for letsencrypt to validate the server. Once the certificate is generated, restart the server.

##### Using custom SSL certificates

If using LetsEncrypt is not an option, you can provide your custom certificates using the `sslCertificatesDirectory` option. The option must have the path for a directory where the certificates are placed following this structure:

- Certificates directory folder:
- [folder named as each domain]
- `privkey.pem`
- `fullchain.pem`

### Configuration options

##### Common options
Expand Down

0 comments on commit 7cd939c

Please sign in to comment.