Textualize / textual-serve

Serve Textual apps locally
MIT License
186 stars 8 forks source link

update websocket uri to use wss if https is in the Server.public_url #10

Closed HoughIO closed 2 months ago

HoughIO commented 4 months ago

After testing with an public https with certs I got this in the browser:

index.js:143 Uncaught (in promise) DOMException: Failed to construct 'WebSocket': An insecure WebSocket connection may not be initiated from a page loaded over HTTPS.
    at TextualTerminal.connect (webpack://textual/./src/index.js?:143:19)
    at eval (webpack://textual/./src/index.js?:221:24)
    at NodeList.forEach (<anonymous>)
    at window.onload (webpack://textual/./src/index.js?:214:13)
connect @ index.js:143
eval @ index.js:221
window.onload @ index.js:214
load (async)
eval @ index.js:205
./src/index.js @ textual.js:179
__webpack_require__ @ textual.js:203
(anonymous) @ textual.js:260
(anonymous) @ textual.js:262

This seems to be because the websockets are hardcoded to use ws instead of wss.

sstoops commented 4 months ago

I had made a similar fork to experiment with something in my local cluster. Yours appears to be more thorough, however.

daddycocoaman commented 4 months ago

+1 for this PR (maybe with the exception of conflicting formatting 😬)

HoughIO commented 4 months ago

Removed the formatting.

iovaris commented 3 months ago

+1 running into this issue right now trying to use textual-serve with a reverse proxy

HoughIO commented 2 months ago

@willmcgugan Can I request a review on this one? 😃

daddycocoaman commented 2 months ago

20240827_154003.png