liuweiGL / vite-plugin-mkcert

Provide certificates for vite's https dev service.
https://www.npmjs.com/package/vite-plugin-mkcert
MIT License
544 stars 37 forks source link

NET::ERR_CERT_AUTHORITY_INVALID #35

Closed quantumwebco closed 2 years ago

quantumwebco commented 2 years ago

Describe the bug

Installed the plugin, added to config as the docs say. But the certificate is invalid. It says it's issued to my user and group rather than localhost or something and it just says it's invalid, not stored in trusted root etc.

Reproduction

Just a new fresh vite install

System Info

Output of npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers:

 System:
    OS: Linux 5.10 Ubuntu 20.04.4 LTS (Focal Fossa)
    CPU: (32) x64 AMD Ryzen 9 5950X 16-Core Processor
    Memory: 13.90 GB / 15.57 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 16.14.2 - ~/.nvm/versions/node/v16.14.2/bin/node
    Yarn: 1.22.18 - ~/.nvm/versions/node/v16.14.2/bin/yarn
    npm: 8.12.1 - ~/.nvm/versions/node/v16.14.2/bin/npm

Used package manager: yarn

Logs


liuweiGL commented 2 years ago

Sorry,i can not get any useful information from your description, please provide debug logs or screenshots.

quantumwebco commented 2 years ago

I think it's a WSL2 thing. I did a completely fresh install of vite with vue, installed this plugin, added it to config, ran dev and get the error

I tried following this guide https://www.ashleyconnor.co.uk/2021/06/07/configuring-ssl-certificates-for-local-development but the plugin generates a new cert inside linux and uses that so it's not valid in windows

I see the mkcertPath but the docs are lacking so couldn't get it to read from the proper mkcert keys

Gave up in the end and created a proper vhost in apache and created a proper key/crt file which works fine