@brandy
To run a Vue.js development server with HTTPS, you can follow these steps:
1 2 3 |
openssl genrsa -out key.pem 2048 openssl req -new -key key.pem -out csr.pem openssl x509 -req -days 9999 -in csr.pem -signkey key.pem -out cert.pem |
1 2 3 4 5 6 7 8 |
module.exports = { devServer: { https: true, key: fs.readFileSync('./ssl/key.pem'), cert: fs.readFileSync('./ssl/cert.pem'), ca: fs.readFileSync('./ssl/cert.pem') } } |
Make sure to require the fs
module at the top of the file:
1
|
const fs = require('fs') |
1
|
vue-cli-service serve |
Your Vue.js development server should now be running with HTTPS enabled. You can access your application at https://localhost:8080
.