liuweiGL / vite-plugin-mkcert

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

SSL error when using WSL prevents browsing the site #57

Closed Gorthog closed 4 months ago

Gorthog commented 1 year ago

Describe the bug

When using WSL, the browser in windows side does not accept the SSL as valid. There is no way to bypass it. The browser refuses to proceed.

Maybe it lacks the CA certificate. If you can explain how I can transfer the CA certificates created by mkcert to windows I believe it would solve the problem. Also, any workaround how to convince the browser to let me continue even if it thinks the site is unsafe could also be acceptable.

Reproduction

in WSL clone https://github.com/Gorthog/vite-plugin-mkcrt-wsl

start the project with pnpm dev in windows side browse to the domain dev.cynet.com (you will need to add it to hosts file, pointing to 127.0.0.1). you will see an SSL error

image

System Info

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

  System:
    OS: Linux 5.15 Ubuntu 20.04.3 LTS (Focal Fossa)
    CPU: (24) x64 12th Gen Intel(R) Core(TM) i9-12900K
    Memory: 28.57 GB / 31.23 GB
    Container: Yes
    Shell: 3.5.1 - /usr/bin/fish
  Binaries:
    Node: 16.19.0 - /usr/local/bin/node
    Yarn: 1.22.19 - ~/.yarn/bin/yarn
    npm: 8.19.3 - /usr/local/bin/npm
  npmPackages:
    vite: ^4.0.0 => 4.0.4

Used package manager: pnpm

Logs

VITE v4.0.4  ready in 222 ms

  ➜  Local:   https://localhost:5174/
  ➜  Network: https://172.21.44.205:5174/
  ➜  Network: https://172.18.0.1:5174/
  ➜  press h to show help
  vite:deps scanning for dependencies... +0ms
  vite:deps Crawling dependencies using entries:
  vite:deps   /home/amir/projects/vite-plugin-mkcrt-wsl/index.html +0ms
  vite:resolve 0.15ms /src/main.tsx -> /home/amir/projects/vite-plugin-mkcrt-wsl/src/main.tsx +0ms
  vite:resolve 1.35ms react -> /home/amir/projects/vite-plugin-mkcrt-wsl/node_modules/.pnpm/react@18.2.0/node_modules/react/index.js +2ms
  vite:resolve 0.50ms react-dom/client -> /home/amir/projects/vite-plugin-mkcrt-wsl/node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/client.js +1ms
  vite:resolve 0.35ms ./App -> /home/amir/projects/vite-plugin-mkcrt-wsl/src/App.tsx +1ms
  vite:deps Scan completed in 18.68ms: {
  react: '/home/amir/projects/vite-plugin-mkcrt-wsl/node_modules/.pnpm/react@18.2.0/node_modules/react/index.js',
  'react-dom/client': '/home/amir/projects/vite-plugin-mkcrt-wsl/node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/client.js'
} +10ms
  vite:deps dependencies found by scanner: react, react-dom/client +23ms
  vite:resolve 0.36ms react-dom -> /home/amir/projects/vite-plugin-mkcrt-wsl/node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/index.js +0ms
  vite:resolve 0.59ms react -> /home/amir/projects/vite-plugin-mkcrt-wsl/node_modules/.pnpm/react@18.2.0/node_modules/react/index.js +3ms
  vite:resolve 0.35ms scheduler -> /home/amir/projects/vite-plugin-mkcrt-wsl/node_modules/.pnpm/scheduler@0.23.0/node_modules/scheduler/index.js +19ms
  vite:deps deps bundled in 47.62ms +50ms

liuweiGL commented 1 year ago

This might help you https://github.com/FiloSottile/mkcert/issues/357

liuweiGL commented 1 year ago

Or you can manually install the CA in windows side https://github.com/FiloSottile/mkcert#installing-the-ca-on-other-systems