How To Setup HTTPS on localhost

I've read through the Vite docs, and they suggest using the @vitejs/plugin-basic-ssl or vite-plugin-mkcert plugin to enable HTTPS on your localhost. I've tried the following two options and neither work. When I install mkcert and configure vite.config.ts as follows, the server won't start when I run npm run dev.
import { defineConfig } from "@solidjs/start/config";
import mkcert from 'vite-plugin-mkcert'

export default defineConfig({
start: { ssr: false },
plugins: [ mkcert() ]
});
import { defineConfig } from "@solidjs/start/config";
import mkcert from 'vite-plugin-mkcert'

export default defineConfig({
start: { ssr: false },
plugins: [ mkcert() ]
});
Alternatively, when I install basic-ssl and configure vite.config.tx as follows, the server will start, but I get a host of errors on http, and https won't load at all.
import { defineConfig } from "@solidjs/start/config";
import basicSsl from '@vitejs/plugin-basic-ssl';

export default defineConfig({
start: { ssr: false },
plugins: [
basicSsl()
]
});
import { defineConfig } from "@solidjs/start/config";
import basicSsl from '@vitejs/plugin-basic-ssl';

export default defineConfig({
start: { ssr: false },
plugins: [
basicSsl()
]
});
Here are the errors on https:
client.ts:77 WebSocket connection to 'ws://localhost:52194/_build/' failed:

client.ts:339 GET http://localhost:52194/_build/ net::ERR_EMPTY_RESPONSE
client.ts:77 WebSocket connection to 'ws://localhost:52194/_build/' failed:

client.ts:339 GET http://localhost:52194/_build/ net::ERR_EMPTY_RESPONSE
Here's the error on https:
crbug/1173575, non-JS module files deprecated.VM10:5
crbug/1173575, non-JS module files deprecated.VM10:5
Any suggestions would be appreciated. Thanks.
3 Replies
thiccaxe
thiccaxe11mo ago
i setup a caddy reverse proxy and trust the caddy cert on a dev browser
rd3
rd311mo ago
i've just used 'npm install -D @vitejs/plugin-basic-ssl'
Chris P Bacon
Chris P Bacon9mo ago
is there any update for this? or can someone explain to me why the mkcert plugin does not work? it works flawlessly for my analog app, so I had hoped it would work just as well for Start
Want results from more Discord servers?
Add your server