Skip to content

Commit d144fb9

Browse files
authored
docs: update devServer.https (webpack#5437)
1 parent 87aa44f commit d144fb9

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/content/configuration/dev-server.mdx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,31 @@ To pass your own certificate via the CLI use the following options:
607607
npx webpack serve --https-key ./path/to/server.key --https-cert ./path/to/server.crt --https-cacert ./path/to/ca.pem
608608
```
609609

610+
`webpack-dev-server >= v4.2.0` allows you to set additional [TLS options](https://nodejs.org/api/tls.html#tls_tls_createsecurecontext_options) like `minVersion`. Also, you can directly pass the contents of respective files:
611+
612+
**webpack.config.js**
613+
614+
```javascript
615+
const fs = require('fs');
616+
const path = require('path');
617+
618+
module.exports = {
619+
devServer: {
620+
https: {
621+
minVersion: 'TLSv1.1',
622+
key: fs.readFileSync(path.join(__dirname, './server.key')),
623+
pfx: fs.readFileSync(path.join(__dirname, './server.pfx')),
624+
cert: fs.readFileSync(path.join(__dirname, './server.crt')),
625+
ca: fs.readFileSync(path.join(__dirname, './ca.pem')),
626+
passphrase: 'webpack-dev-server',
627+
requestCert: true,
628+
},
629+
},
630+
};
631+
```
632+
633+
W> Don't specify `https.ca` and `https.cacert` options together, if specified `https.ca` will be used. `https.cacert` is deprecated and will be removed in next major release.
634+
610635
## devServer.headers
611636

612637
`function` `object`

0 commit comments

Comments
 (0)