vite-plugin-basic-ssl icon indicating copy to clipboard operation
vite-plugin-basic-ssl copied to clipboard

Cant confirm cert on custom host with dev domain

Open grindpride opened this issue 2 years ago • 3 comments
trafficstars

OS: Windows 11

vite --https --host any-custom-host.dev --port 443 --mode multi --strictPort

vite.config.ts

export default defineConfig({
  server: { https: true },
  plugins: [vue(), basicSsl()],
  preview: {
    https: true
  }
})

there is no cert confirm button in chrome and firefox

host with ru domain works well

vite-plugin-mkcert works well with .dev domain

grindpride avatar Mar 27 '23 11:03 grindpride

I think this should be addressed in https://github.com/vitejs/vite-plugin-basic-ssl/pull/22 as you can pass the custom host to the domains option. Though I think it'd be nice to automatically add that for server.host too

bluwy avatar Feb 25 '25 12:02 bluwy

Actually this is indeed about the .dev domain specifically as browsers have different hardcoded handling for it, but I'm not sure what we need to do to fix it.

bluwy avatar Feb 26 '25 08:02 bluwy

.dev is included in the HSTS preload list (chromium's one) and it seems browsers require a certificate trusted by the machine for those domains. https://stackoverflow.com/a/49505444

mkcert works because it installs a local CA to the machine, which will make the self-signed cert "trusted". This means you (and your browser) will "trust" any certs created by that local CA. This requires you to keep the local CA key safe (or delete it).

sapphi-red avatar Mar 03 '25 12:03 sapphi-red