10

I am trying to run a vue-cli project using https.

As per the instructions here How to run Vue.js dev serve with https?

I've added the https setting to the vue.config.js as per below:

module.exports = {
    devServer: {
      https: true
    }
}

When I run the app it correctly runs as https://localhost:8080 however Chrome throws an ERR_CERT_AUTHORITY_INVALID error.

It appears I need to setup an SSL certificate in Windows and set some configuration in vue.config.js. Does anyone know how to do this? Note, this question applies specifically to Windows.

Simcha
  • 17
  • 4
Jim Culverwell
  • 2,623
  • 6
  • 25
  • 28
  • 5
    Under the hood Vue-cli is just using `webpack-dev-server`, so it's less to do with `vue` and more to do with the aforementioned. Webpack has actually provided a full guide and walkthrough to creating an https driven local environment on Windows. You can [find the guide here](https://github.com/webpack/webpack-dev-server/tree/master/examples/cli/https) – Ohgodwhy May 01 '19 at 14:33
  • 2
    Your localhost self-signed certificate (generated by vue-cli) is not trusted by your computer/browser. Have you checked this famous question already in order to trust it ? --https://stackoverflow.com/q/7580508/2474214 – Cédric M. May 01 '19 at 15:07
  • @Ohgodwhy The Link to the guide is broken. – Marcel May 15 '21 at 10:53
  • 1
    @Marcel https://github.com/webpack/webpack-dev-server/tree/master/examples/https/object – grovskiy Sep 11 '21 at 10:01

1 Answers1

0

This happened to me when I was building multiple applications that were sometimes sharing the same port. I fixed it by switching to a different port:

module.exports = {
   devServer: {
     port: 8081
   }
}
Simcha
  • 17
  • 4