boypt / simple-torrent

☁️ Simple Torrent: a self-hosted remote torrent client (rebranded from Cloud Torrent)
GNU Affero General Public License v3.0
1k stars 312 forks source link

Website hangs after websocket turned on #129

Closed msberends closed 3 years ago

msberends commented 3 years ago

The app hangs when you push the lightning bolt in 1.3.1. It keeps saying ‘Connecting’. Restarting does not help.

I don’t see anything changed in config.json, so where is this set? I cannot undo it now…

boypt commented 3 years ago

are u using a nginx as frontend server? the previous config of nginx cannot support both eventstream and websocket mode. refer to the wiki page for an updated config

https://github.com/boypt/simple-torrent/wiki/ReverseProxy#nginx

The mode of connect is recored in your browser local storage, you can also delete the veloxCON item from F12 dev tools.

I will make the connection button clickable when such happends.

msberends commented 3 years ago

No, Apache:

<VirtualHost *:443>
  SSLEngine on
  SSLProxyEngine On
  ServerName some.domain.zzz

  <Proxy *>
    Allow from localhost
  </Proxy>

  ProxyPass / http://localhost:8085/
  ProxyPassReverse / http://localhost:8085/
  ProxyRequests Off
</VirtualHost>

Thanks! I’ll look for veloxCON. What is the benefit of using websocket? That’s not documented I think.

boypt commented 3 years ago

Add 3 lines to you config will be ok.

<VirtualHost *:443>
  SSLEngine on
  SSLProxyEngine On
  ServerName some.domain.zzz

  <Proxy *>
    Allow from localhost
  </Proxy>

  RewriteEngine On
  RewriteCond %{HTTP:Upgrade} =websocket [NC]
  RewriteRule /(.*)           ws://localhost:8085/$1 [P,L]

  ProxyPass / http://localhost:8085/
  ProxyPassReverse / http://localhost:8085/
  ProxyRequests Off
</VirtualHost>

Websocket is just another technic the browser establishing a long connection to the server, only that websocket is bidirectional, evenstream is only down forward. But in this project only use the down forward tunnel.

I have a node proxied by cloudflare, the websocket mode seems response faster.

I'll document this in the wiki page later.