fix(client): use wss:// when served over HTTPS#96
Open
acooks wants to merge 1 commit into
Open
Conversation
The WebSocket URI scheme was hardcoded to ws://, so loading the client over HTTPS triggered a mixed-content error and the browser blocked the live-data connection (it never opened). Derive the scheme from location.protocol (wss:// on HTTPS, ws:// otherwise) and only append a port when one is present, so it also works behind a TLS-terminating reverse proxy on the default port 443. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The WebSocket URI scheme is hardcoded to
ws://inhtml5-client/src/js/jittertrap.js:When the client is served over HTTPS, the browser blocks this as mixed content (an insecure
ws://socket from a secure page), so the live-data websocket never connects.Fix
Derive the scheme from
location.protocol, and only append a port when one is present:wss://on HTTPS pages,ws://otherwise.location.portis"").Testing
Verified on a live deployment behind nginx (TLS termination →
proxy_passtojt-server): the page loads over HTTPS and the websocket upgrade completes (101 Switching Protocolsoverwss://). Plain-HTTP behaviour is unchanged.🤖 Generated with Claude Code