You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 607efc4
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+31-12Lines changed: 31 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,22 +1,22 @@
1
1
# HTTPS server running on localhost
2
2
3
-
Run a server on localhost with a locally-trusted SSL certificate. Serve static files, proxies an existing server, or you can import as module in your project.
3
+
Run a server on localhost with a locally-trusted SSL certificate. Serve static files, define your own routes, or import it as a module in your project.
4
4
5
-
The certificate is provided by [mkcert](https://github.com/FiloSottile/mkcert). It automatically creates and installs a local CA in the system and browsers root store, and use it to generate certificates that your machine trust. **This are not valid certificates, are for development only, and will only work in your machine.**
5
+
The certificate is provided by [mkcert](https://github.com/FiloSottile/mkcert). It automatically creates and installs a local CA in the system and browser root stores, and uses it to generate certificates that your machine trusts. **These are not valid certificates, they are for development only, and will only work in your machine.**
6
6
7
7
Certificates support macOS, Linux and Windows. [The full list of supported root stores is available in the original repo](https://github.com/FiloSottile/mkcert/blob/v1.4.4/README.md#supported-root-stores).
8
8
9
9
## Install and use standalone
10
10
11
11
```sh
12
12
# install
13
-
npm i -g --only=prod https-localhost
13
+
npm i -g https-localhost
14
14
15
15
# run
16
16
serve ~/myproj
17
17
```
18
18
19
-
How it works:
19
+
Usage notes:
20
20
21
21
-`sudo` may be necessary.
22
22
- If a static path is not provided the current directory content will be served.
@@ -27,6 +27,8 @@ How it works:
27
27
-`--reinstall`: force certificate re-generation (`REINSTALL=true`)
28
28
- Specifying a port number prevents HTTP to HTTPS redirect.
29
29
30
+
### Standalone binaries
31
+
30
32
If you don't have Node.js installed just use a packaged version! Download it from the [release page](https://github.com/daquinoaldo/https-localhost/releases).
Uninstalling the npm package removes the generated certificates automatically.
72
+
54
73
## Troubleshooting
55
74
56
75
### root required
57
76
58
-
-**At first run** this tool generate a trusted certificate. The sudo password may be required. If you cannot provide the sudo password generate a `localhost.key` and `localhost.crt` and specify its path with `CERT_PATH=/diractory/containing/certificates/ serve ~/myproj`.
77
+
-**At first run** this tool generates a trusted certificate. The sudo password may be required. If you cannot provide the sudo password generate a `localhost.key` and `localhost.crt` and specify its path with `CERT_PATH=/directory/containing/certificates/ serve ~/myproj`.
59
78
-**At each run** the password may be required to run the server on port 443 and 80. To avoid the script ask for password specify a different port number: `PORT=4433 serve ~/myproj`.
60
79
61
80
### EACCES
@@ -72,4 +91,4 @@ And in general all the cases when the script runs but the connection is marked a
72
91
73
92
Force a reinstall of the certificate with `REINSTALL=true serve`. `sudo` may be required on linux and MacOS.
74
93
75
-
If the problem is solved you should be able to use https-localhost also as module.
94
+
If the problem is solved you should be able to use https-localhost as a module too.
0 commit comments