fix: use wss:// for WebSocket on HTTPS pages#22
Merged
Conversation
The WebSocket URL was always constructed with ws:// regardless of the page protocol. On HTTPS pages, browsers block mixed-content WebSocket connections with a SecurityError, making LiveTemplate non-functional behind any TLS-terminating reverse proxy (Fly.io, Cloudflare, AWS ALB). Now detects window.location.protocol and uses wss: for https: pages. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Review: The fix is correct and necessary. Hardcoding The scheme detection logic ( No issues. LGTM. |
There was a problem hiding this comment.
Pull request overview
Fixes WebSocket connections failing on HTTPS pages due to mixed-content blocking by dynamically selecting wss: or ws: based on the page protocol.
Changes:
- Replace hardcoded
ws://scheme with protocol-aware scheme selection for WebSocket URLs
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
ws://regardless of page protocolSecurityErrorwindow.location.protocoland useswss:for HTTPS pagesRoot Cause
transport/websocket.ts:206always constructed:Behind TLS-terminating reverse proxies (Fly.io, Cloudflare, AWS ALB), the page loads over HTTPS but the client tried to open a
ws://WebSocket — browsers reject this as mixed content.Fix
Test plan
🤖 Generated with Claude Code