LiveReload doesn't work when TLS is enabled
See original GitHub issueWhat version of Remix are you using?
1.3.5
Steps to Reproduce
-
Create a server with TLS keys
-
Attach remix route handler to it
-
Load site
-
Error appears in console:
WebSocket connection to 'wss://moxy.cow-augmented.ts.net:8002/socket' failed: An SSL error has occurred and a secure connection to the server cannot be made.
-
Change files, observe that they are not reloaded live. (Server rebuilds, but the ws push doesn’t work.)
Expected Behavior
Expect that WebSocket.Server would be able to listen over https somehow.
Actual Behavior
WebSocket connection to ‘wss://moxy.cow-augmented.ts.net:8002/socket’ failed: An SSL error has occurred and a secure connection to the server cannot be made.
Tracked it down to this bit in ./node_modules/@remix-run/dev/cli/commands.js
let wss = new WebSocket__default["default"].Server({
port: config$1.devServerPort
});
It appears that the only way for a ws server to speak tls is to attach to an existing server.
Something like this:
const server = config.devServerCert && config.devServerKey ? https.createServer({
cert: config.devServerCert,
key: config.devServerKey,
}) : http.createServer()
server.listen(config.devServerPort)
let wss = new WebSocket.Server({ server });
Issue Analytics
- State:
- Created a year ago
- Reactions:3
- Comments:10
Top Results From Across the Web
Setting up Grunt to serve Livereload over SSL - Stack Overflow
My goal is to run livereload over httpS: port 9000. Maybe am I missing some part, like "run Grunt to make it load...
Read more >Complete guide to livereload over ssl (https) using grunt watch
For livereload to work over https, you need to provide a path to both a private key file and a certificate. These can...
Read more >Using Spring Boot Devtools with LiveReload - Rolf Engelhard
If reloading doesn't work, open your browser's devtools (ah—another one). Maybe it's just a resource, which couldn't be loaded. Or the ...
Read more >Live Reloading Content during Development
For more info on enabling and disabling see below. Note also that the Web Server based live reload is not useful for REST...
Read more >TLS (SSL) | Node.js v19.3.0 Documentation
When using ESM, if there is a chance that the code may be run on a build of Node.js where crypto support is...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Being able to run a
dev
server on anhttps
domain (localhost
,lvh.me
) would be wonderful 👌Doesn’t seem like #4123 or #4107 will be merged anytime soon… so I solved it using the attached snippet.
The below connects to the web socket created when calling “remix watch” command, and spins up an additional web socket that uses an https server instance.
Once a message to the remix web socket is sent, it is then sent to the https one.
NOTE: The above example is missing the https server portion. Just make sure to set the live reload component port to the same port as the https server.
app/root.tsx: