--https mode causes issues in dev by trying to connect to wss://localhost:24678
See original GitHub issueDescribe the bug
In --https
mode, the site is served at https://localhost:3000
and so the Vite websocket connection that is attempted fails, because it tries to make it at wss://localhost:24678
when it exists at ws://localhost:24678
. This results in the page being periodically reloaded.
Logs
Firefox can’t establish a connection to the server at wss://localhost:24678/.
[vite] server connection lost. polling for restart... client:340:13
[vite] connecting...
To Reproduce
npx svelte-kit dev --https
Open console and/or network logs and wait. Turn on timestamps on the console to help see what’s happening. The page refresh rate seems to vary widely, and I haven’t figured out what causes that to happen.
Expected behavior I don’t think we can force an HTTPS page to load a non-secured websocket, so we’ll have to figure out how to serve a secure websocket over that port. This will also still probably cause issues because it will be a self-signed cert. I don’t know how to resolve this.
Severity High. HTTPS mode is not very usable if the browser refreshes periodically.
Additional context I told you HTTPS mode was a mistake and you didn’t believe me.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:12
- Comments:24 (16 by maintainers)
Top GitHub Comments
https://github.com/sveltejs/kit/issues/581#issuecomment-805398830 hinted at a way that seems to work for me:
This problem has stopped me dead in my tracks. I’m working on a new project w/ oauth and I need an https callback to receive my login token. I hope this gets addressed soon but I’m open to workarounds in the meantime. Thank you.