Skip to content

fix(gateway): correct ws scheme conversion for https urls#18984

Closed
CharlieKerfoot wants to merge 1 commit into
NousResearch:mainfrom
CharlieKerfoot:fix/replace-http-runs-before
Closed

fix(gateway): correct ws scheme conversion for https urls#18984
CharlieKerfoot wants to merge 1 commit into
NousResearch:mainfrom
CharlieKerfoot:fix/replace-http-runs-before

Conversation

@CharlieKerfoot

Copy link
Copy Markdown
Contributor

Summary

In gateway/platforms/homeassistant.py:142, the WebSocket URL conversion replaced http:// before https://, so an https:// Home Assistant URL became ws://s://... and the connection failed before auth.

Fix

Swap the order so https:// is replaced with wss:// first, then http:// with ws://. The https case no longer matches the http prefix because it has already been rewritten.

Tests

Verified manually by pointing _hass_url at an https:// instance and confirming the resulting ws_url is wss://.../api/websocket and the WebSocket handshake succeeds; http:// URLs still convert to ws:// as before.

@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists labels May 2, 2026
@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Merged via PR #19182. Trivial but critical — swap the replace order to prevent https mangling. Thanks @CharlieKerfoot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants