webtorrent / bittorrent-tracker

🌊 Simple, robust, BitTorrent tracker (client & server) implementation
https://webtorrent.io
MIT License
1.78k stars 319 forks source link

Error: Unsupported tracker protocol: ws://tracker.hotreload.tech from WebTorrent #339

Closed PaTiToMaSteR closed 4 years ago

PaTiToMaSteR commented 4 years ago

What version of this package are you using? latest. Also happened with previous versions

What operating system, Node.js, and npm version? CentOS 7

What happened? Errors from webtorrent while connecting to my tracker

What did you expect to happen? See no errors.

Are you willing to submit a pull request to fix this bug? No, I think I have not enough knowledge of the system to do that

hey guys! hi there. A question regarding bittorrent-tracker Error accessing my tracker directly from the web browser: d14:failure reason33:invalid action in HTTP request: /e d14:failure reason17:invalid info_hashe

i'm not able to make my tracker work, using &tr=wss://tracker.btorrent.xyz&tr=wss://tracker.openwebtorrent.com&tr=ws://tracker.hotreload.tech&tr=wss://tracker.hotreload.tech

My trackers fail. Let's start with how do I initialize the tracker: bittorrent-tracker --trust-proxy --interval 1000 --http --udp --ws HTTP tracker: http://localhost:8000/announce UDP tracker: udp://0.0.0.0:8000 UDP6 tracker: udp://localhost:8000 WebSocket tracker: ws://localhost:8000 Tracker stats: http://localhost:8000/stats

WebTorrent says: warning: Error: Unsupported tracker protocol: ws://tracker.hotreload.tech webtorrent.min.js:6 WebSocket connection to 'wss://tracker.hotreload.tech/' failed: Error during WebSocket handshake: Unexpected response code: 500 channel.js:564 warning: Error: connection error to wss://tracker.hotreload.tech

If I access http://tracker.hotreload.tech/: d14:failure reason33:invalid action in HTTP request: /e

Accessing http://tracker.hotreload.tech/announce d14:failure reason17:invalid info_hashe

http://tracker.hotreload.tech/stats works well

My apache config: <VirtualHost 137.74.44.40:80> ServerName tracker.hotreload.tech

<IfModule mod_proxy.c>
            SetEnv proxy-nokeepalive 1
            SetEnv proxy-initial-not-pooled 1
            ProxyErrorOverride On
    ProxyRequests Off
    ProxyPreserveHost On
    ProxyVia Full
    ProxyPass / http://127.0.0.1.tech:8000/
    ProxyPassReverse / http://127.0.0.1:8000/

    <Proxy *>
        AllowOverride All
    </Proxy>
</IfModule>

DiegoRBaquero commented 4 years ago

I'm just it has to do with the way you are proxying, this is not http, this is wss. For example nginx requires different config: http://nginx.org/en/docs/http/websocket.html

Not really a problem in the library.

PaTiToMaSteR commented 4 years ago

Thanks!

PaTiToMaSteR commented 4 years ago

<VirtualHost 137.74.44.40:443> ServerName tracker.EXAMPLE.COM

 SSLEngine on
 SSLProxyEngine On
 ProxyRequests Off

SSLCertificateFile /etc/pki/tls/certs/tracker.EXAMPLE.COM.cert
SSLCertificateKeyFile /etc/pki/tls/private/tracker.EXAMPLE.COM.key
SSLCertificateChainFile /etc/pki/tls/certs/tracker.EXAMPLE.COM.bundle
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown

ProxyPreserveHost On RequestHeader set X-Forwarded-Proto "http" ProxyPass / http://127.0.0.1:8000/ ProxyPassReverse / http://127.0.0.1:8000/

RewriteEngine on RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC] RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC] RewriteRule .* ws://127.0.0.1:8000%{REQUEST_URI} [P]

I had also not activated in http.conf this: LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so LoadModule ssl_module modules/mod_ssl.so