rickparrish / fTelnet

fTelnet: An HTML5 WebSocket client
GNU Affero General Public License v3.0
70 stars 38 forks source link

run over https #6

Closed ftoledo closed 4 years ago

ftoledo commented 7 years ago

I move my http server to https and fTelnet do no work. Any chance to make it work on both http and https?

work: http://bbs.docksud.com.ar/telnet/

do not work: https://bbs.docksud.com.ar/telnet/

ftelnet is fantastic! thanks!

echicken commented 7 years ago

This is likely due to mixed secure/insecure content. If the client is browsing your site over HTTPS, then the websocket connection needs to be secure (WSS) as well, or it won't work with most browsers.

I believe that Rick has WSS proxies available: http://proxy.ftelnet.ca/

If you're using the websocket service that comes with Synchronet, you can put it behind an HTTPS reverse proxy such as nginx; this is what I do.

ftoledo commented 7 years ago

i try to use this settings on nginx with no succes , change the ftelnet websockert proxy port to 1124 (1123 is the original synchronet websocket) and can connect, any idea?.

server {
    listen 1124 ssl;
    server_name bbs.docksud.com.ar
    ssl on;

    location / {

        # prevents 502 bad gateway error
        proxy_buffers 8 32k;
        proxy_buffer_size 64k;

        # redirect all HTTP traffic to localhost:8088;
        proxy_pass http://127.0.0.1:1123;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        #proxy_set_header X-NginX-Proxy true;

        # enables WS support
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

        proxy_read_timeout 999999999;

    }
}

ftelnet part:

        var host = "bbs.docksud.com.ar";
        fTelnet.Hostname = host;
        fTelnet.Port = 23;
        fTelnet.ProxyHostname = host;
        //fTelnet.ProxyPort = 1123;
        fTelnet.ProxyPort = 1124;
        fTelnet.Init();

echicken commented 7 years ago

Those settings look similar to what I have.

Something strange is happening on your site though; when I try to use fTelnet, it attempts to connect to:

wss://bbs.docksud.com.ar:11235/bbs.docksud.com.ar/23

On my site, I don't use the fTelnet.ProxyHostname or fTelnet.ProxyPort settings. Maybe try commenting those out, and setting fTelnet.Port to 1124 or even 1123 and see if it helps.

rickparrish commented 6 years ago

Sorry, no experience with proxying with nginx like that so can't help.

echicken is right though: ProxyHostname and ProxyPort shouldn't be used, unless you're connecting through one of my public proxies. If you comment those out you may have better luck.