|
1 | 1 | # https
|
2 | 2 |
|
| 3 | +By default webpack-dev-server will generate a self-signed, 2048 bit, sha256 SSL |
| 4 | +Certificate, which is used to enable https. The certificate will be located in the |
| 5 | +`ssl` directory afte the server is started for the first time. The generated |
| 6 | +certificate is only good for 30 days, at which point it'll be regenerated. |
| 7 | + |
| 8 | +We highly recommend creating and managing your own certificates. Please see the |
| 9 | +following resources for doing so: |
| 10 | + |
| 11 | +* (MacOS) https://certsimple.com/blog/localhost-ssl-fix |
| 12 | +* (Windows) https://technet.microsoft.com/itpro/powershell/windows/pkiclient/new-selfsignedcertificate |
| 13 | + |
| 14 | +## Getting Started |
| 15 | + |
3 | 16 | ```shell
|
4 | 17 | node ../../bin/webpack-dev-server.js --open --https
|
5 | 18 | ```
|
6 | 19 |
|
7 |
| -A fake certificate is used to enable https. |
| 20 | +## Using Your Certificate |
| 21 | + |
| 22 | +Options are available for using your own SSL Certificate in your preferred or |
| 23 | +OS-required format. |
8 | 24 |
|
9 |
| -You can provide the following SSL options to override the fake certificate: |
| 25 | +Given the base command `node ../../bin/webpack-dev-server.js --open --https`, append |
| 26 | +one of the following: |
10 | 27 |
|
11 |
| -* Certificate options e.g. `node ../../bin/webpack-dev-server.js --open --https --cert=../../ssl/server.pem --key=../../ssl/server.pem` |
12 |
| -* PFX and Passphrase e.g. `node ../../bin/webpack-dev-server.js --open --https --pfx=./test_cert.pfx --pfx-passphrase=sample` |
| 28 | +* (PEM Files) `--cert=../../ssl/server.pem --key=../../ssl/server.pem` |
| 29 | +* (PFX and Passphrase) `--pfx=./test_cert.pfx --pfx-passphrase=sample` |
13 | 30 |
|
14 |
| -## What should happen |
| 31 | +## What To Expect |
15 | 32 |
|
16 |
| -The script should open `https://localhost:8080/`. Your browser will probably give you a warning about using an invalid certificate. After ignoring this warning, you should see "It's working." |
| 33 | +The script should open `https://localhost:8080/`in your default browser. If your |
| 34 | +browser displays a warning about a non-trusted certificate, follow the procedure |
| 35 | +for your browser of choice to continue. After doing so you should see "It's Working" |
| 36 | +displayed on the page. |
0 commit comments