[GH-ISSUE #9] Can't stream torrents who are in subfolders #221

Closed
opened 2026-03-15 02:32:10 +03:00 by kerem · 14 comments
Owner

Originally created by @zobrak on GitHub (Oct 8, 2014).
Original GitHub issue: https://github.com/asapach/peerflix-server/issues/9

Hi !

When I try to stream a torrent wich is mad by a floder and the video is in a subfolder I gt a 404 error:

Not Found
The requested URL /torrents/24ee2e7b82eaba379377557aad92830ccd328173/files/torrent.name/torrent.name.avi was not found on this server.

At the same time the status bar is in progress but there's not any data abouts speed or peers, all is at 0.

The datas are under

/tmp/torrent-stream/24ee2e7b82eaba379377557aad92830ccd328173/torrent.name/

When I fetch a torrent where the file is not in a subfolder, the streaming works.

What can I do ?

Originally created by @zobrak on GitHub (Oct 8, 2014). Original GitHub issue: https://github.com/asapach/peerflix-server/issues/9 Hi ! When I try to stream a torrent wich is mad by a floder and the video is in a subfolder I gt a 404 error: <code> Not Found The requested URL /torrents/24ee2e7b82eaba379377557aad92830ccd328173/files/torrent.name/torrent.name.avi was not found on this server. </code> At the same time the status bar is in progress but there's not any data abouts speed or peers, all is at 0. The datas are under <code> /tmp/torrent-stream/24ee2e7b82eaba379377557aad92830ccd328173/torrent.name/ </code> When I fetch a torrent where the file is not in a subfolder, the streaming works. What can I do ?
kerem closed this issue 2026-03-15 02:32:15 +03:00
Author
Owner

@asapach commented on GitHub (Oct 8, 2014):

@zobrak, it should work both ways. The only thing to keep in mind is that if you build the URL programmatically, you must urlencode the path, e.g. / becomes %2F.

Can you share the torrent/magnet link that is broken for you?

<!-- gh-comment-id:58430846 --> @asapach commented on GitHub (Oct 8, 2014): @zobrak, it should work both ways. The only thing to keep in mind is that if you build the URL programmatically, you must urlencode the path, e.g. `/` becomes `%2F`. Can you share the torrent/magnet link that is broken for you?
Author
Owner

@zobrak commented on GitHub (Oct 9, 2014):

This one doesn't work for example

http://ppfr.it/2hsv
<!-- gh-comment-id:58462193 --> @zobrak commented on GitHub (Oct 9, 2014): This one doesn't work for example <link>http://ppfr.it/2hsv</link>
Author
Owner

@asapach commented on GitHub (Oct 9, 2014):

Works for me, e.g.: http://localhost:9000/torrents/dbcc055d503485928e52f349acf179812b777c4f/files/%5Bwww.Cpasbien.pe%5D%20Tristesse.Club.2014.FRENCH.DVDRip.XviD-SVR%2F%5Bwww.Cpasbien.pe%5D%20Tristesse.Club.2014.FRENCH.DVDRip.XviD-SVR.avi

<!-- gh-comment-id:58488765 --> @asapach commented on GitHub (Oct 9, 2014): Works for me, e.g.: `http://localhost:9000/torrents/dbcc055d503485928e52f349acf179812b777c4f/files/%5Bwww.Cpasbien.pe%5D%20Tristesse.Club.2014.FRENCH.DVDRip.XviD-SVR%2F%5Bwww.Cpasbien.pe%5D%20Tristesse.Club.2014.FRENCH.DVDRip.XviD-SVR.avi`
Author
Owner

@zobrak commented on GitHub (Oct 10, 2014):

I don't see what I can do...

<!-- gh-comment-id:58613167 --> @zobrak commented on GitHub (Oct 10, 2014): I don't see what I can do...
Author
Owner

@zobrak commented on GitHub (Oct 10, 2014):

Here is my apache log :

88.183.241.107 - - [10/Oct/2014:10:01:16 +0200] "GET /socket.io/1/xhr-polling/8h7Ei6JAy4AJw_W5CFLf?t=1412928078371 HTTP/1.1" 200 489 "https://stream.zobrak.net/" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.101 Safari/537.36"


XXX.XXX.XXX.XXX - - [10/Oct/2014:10:01:17 +0200] "GET /socket.io/1/xhr-polling/8h7Ei6JAy4AJw_W5CFLf?t=1412928079308 HTTP/1.1" 200 491 "https://stream.domain.tld/" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.101 Safari/537.36"


XXX.XXX.XXX.XXX - - [10/Oct/2014:10:01:18 +0200] "GET /torrents/dbcc055d503485928e52f349acf179812b777c4f/files/%5Bwww.Cpasbien.pe%5D%20Tristesse.Club.2014.FRENCH.DVDRip.XviD-SVR%2F%5Bwww.Cpasbien.pe%5D%20Tristesse.Club.2014.FRENCH.DVDRip.XviD-SVR.avi HTTP/1.1" 404 875 "https://stream.domain.tld/" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.101 Safari/537.36"

Here is console log :

GET / 200 15ms - 637b


GET /styles/df04649e.vendor.css 200 13ms - 97.08kb

GET /scripts/8d96e24b.vendor.js 200 56ms - 263.37kb
GET /styles/8b6a747f.main.css 200 20ms - 1.71kb
GET /scripts/fb0914cf.scripts.js 200 7ms - 1.67kb
GET /views/main.html 200 7ms - 2.75kb
info - handshake authorized 8h7Ei6JAy4AJw_W5CFLf
GET /torrents 304 341ms
warn - websocket connection invalid
info - transport end (undefined)
GET /bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.woff 304 81ms
GET /torrents 304 567ms
info - transport end (close timeout)
info - transport end (close timeout)

And here is my vhost :

<VirtualHost *:80>
ServerAdmin webmaster@domain.tld
ServerName stream.domain.tld
Redirect / https://stream.domain.tld

<VirtualHost *:443>
SSLEngine on
SSLProtocol all -SSLv2
SSLProxyEngine On
SSLProxyCheckPeerCN on
SSLProxyCheckPeerExpire on
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM
SSLCertificateFile /etc/ssl/certs/somecertfile.pem
SSLCertificateKeyFile /etc/ssl/private/somekeyfile.key
LogLevel warn
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
ServerSignature Off
ServerAdmin webmaster@domain.tld
ServerName stream.domain.tld

ProxyPass http://localhost:9000/ ProxyPassReverse http://localhost:9000/

... I don't know where else can I check. Maybe the torrents directory permissions ?

<!-- gh-comment-id:58624773 --> @zobrak commented on GitHub (Oct 10, 2014): Here is my apache log : <code> 88.183.241.107 - - [10/Oct/2014:10:01:16 +0200] "GET /socket.io/1/xhr-polling/8h7Ei6JAy4AJw_W5CFLf?t=1412928078371 HTTP/1.1" 200 489 "https://stream.zobrak.net/" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.101 Safari/537.36"</code> <code> XXX.XXX.XXX.XXX - - [10/Oct/2014:10:01:17 +0200] "GET /socket.io/1/xhr-polling/8h7Ei6JAy4AJw_W5CFLf?t=1412928079308 HTTP/1.1" 200 491 "https://stream.domain.tld/" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.101 Safari/537.36"</code> <code> XXX.XXX.XXX.XXX - - [10/Oct/2014:10:01:18 +0200] "GET /torrents/dbcc055d503485928e52f349acf179812b777c4f/files/%5Bwww.Cpasbien.pe%5D%20Tristesse.Club.2014.FRENCH.DVDRip.XviD-SVR%2F%5Bwww.Cpasbien.pe%5D%20Tristesse.Club.2014.FRENCH.DVDRip.XviD-SVR.avi HTTP/1.1" 404 875 "https://stream.domain.tld/" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.101 Safari/537.36" </code> Here is console log : <code> GET / 200 15ms - 637b</code> <code> GET /styles/df04649e.vendor.css 200 13ms - 97.08kb</code> <code>GET /scripts/8d96e24b.vendor.js 200 56ms - 263.37kb</code> <code>GET /styles/8b6a747f.main.css 200 20ms - 1.71kb</code> <code>GET /scripts/fb0914cf.scripts.js 200 7ms - 1.67kb</code> <code>GET /views/main.html 200 7ms - 2.75kb</code> <code> info - handshake authorized 8h7Ei6JAy4AJw_W5CFLf</code> <code>GET /torrents 304 341ms</code> <code> warn - websocket connection invalid</code> <code> info - transport end (undefined)</code> <code>GET /bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.woff 304 81ms</code> <code>GET /torrents 304 567ms</code> <code> info - transport end (close timeout)</code> <code> info - transport end (close timeout)</code> And here is my vhost : <VirtualHost *:80> ServerAdmin webmaster@domain.tld ServerName stream.domain.tld Redirect / https://stream.domain.tld </VirtualHost> <VirtualHost *:443> SSLEngine on SSLProtocol all -SSLv2 SSLProxyEngine On SSLProxyCheckPeerCN on SSLProxyCheckPeerExpire on SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM SSLCertificateFile /etc/ssl/certs/somecertfile.pem SSLCertificateKeyFile /etc/ssl/private/somekeyfile.key LogLevel warn ErrorLog /var/log/apache2/error.log CustomLog /var/log/apache2/access.log combined ServerSignature Off ServerAdmin webmaster@domain.tld ServerName stream.domain.tld <Location /> ProxyPass http://localhost:9000/ ProxyPassReverse http://localhost:9000/ </Location> </VirtualHost> ... I don't know where else can I check. Maybe the torrents directory permissions ?
Author
Owner

@asapach commented on GitHub (Oct 10, 2014):

Can you show me the console log matching this one from apache log:
XXX.XXX.XXX.XXX - - [10/Oct/2014:10:01:18 +0200] "GET /torrents/dbcc055d503485928e52f349acf179812b777c4f/files/%5Bwww.Cpasbien.pe%5D%20Tristesse.Club.2014.FRENCH.DVDRip.XviD-SVR%2F%5Bwww.Cpasbien.pe%5D%20Tristesse.Club.2014.FRENCH.DVDRip.XviD-SVR.avi HTTP/1.1" 404

My guess is that apache doesn't proxy this request properly. Try doing this without apache and try other reverse proxies, e.g. nginx or haproxy.

<!-- gh-comment-id:58633903 --> @asapach commented on GitHub (Oct 10, 2014): Can you show me the console log matching this one from apache log: `XXX.XXX.XXX.XXX - - [10/Oct/2014:10:01:18 +0200] "GET /torrents/dbcc055d503485928e52f349acf179812b777c4f/files/%5Bwww.Cpasbien.pe%5D%20Tristesse.Club.2014.FRENCH.DVDRip.XviD-SVR%2F%5Bwww.Cpasbien.pe%5D%20Tristesse.Club.2014.FRENCH.DVDRip.XviD-SVR.avi HTTP/1.1" 404` My guess is that apache doesn't proxy this request properly. Try doing this without apache and try other reverse proxies, e.g. nginx or haproxy.
Author
Owner

@zobrak commented on GitHub (Oct 10, 2014):

Nothing happens in console while looking for the movie. By the way, files that are not in sub folders don't work no more today

<!-- gh-comment-id:58635608 --> @zobrak commented on GitHub (Oct 10, 2014): Nothing happens in console while looking for the movie. By the way, files that are not in sub folders don't work no more today
Author
Owner

@asapach commented on GitHub (Oct 10, 2014):

If nothing happens in the console, it means that the request doesn't get to peerflix-server.

<!-- gh-comment-id:58636477 --> @asapach commented on GitHub (Oct 10, 2014): If nothing happens in the console, it means that the request doesn't get to peerflix-server.
Author
Owner

@zobrak commented on GitHub (Oct 10, 2014):

Maybe i'm saying bullshit, but if it was a handling issue with apache, why can I get the home page ? and why requests to socket.io goes well ?

<!-- gh-comment-id:58637357 --> @zobrak commented on GitHub (Oct 10, 2014): Maybe i'm saying bullshit, but if it was a handling issue with apache, why can I get the home page ? and why requests to socket.io goes well ?
Author
Owner

@asapach commented on GitHub (Oct 10, 2014):

No idea, maybe apache doesn't like the urlencoded path?
As for socket.io, you should set up apache to proxy websockets for it to work properly: http://httpd.apache.org/docs/2.4/mod/mod_proxy_wstunnel.html

<!-- gh-comment-id:58637855 --> @asapach commented on GitHub (Oct 10, 2014): No idea, maybe apache doesn't like the urlencoded path? As for socket.io, you should set up apache to proxy websockets for it to work properly: http://httpd.apache.org/docs/2.4/mod/mod_proxy_wstunnel.html
Author
Owner

@asapach commented on GitHub (Oct 12, 2014):

Here's an nginx config that seems to work for me:

server {
        listen 443;
        server_name example.com;

        ssl on;
        ssl_certificate /etc/nginx/ssl/server.crt;
        ssl_certificate_key /etc/nginx/ssl/server.key;

        location / {
                proxy_pass http://localhost:9000;
                proxy_http_version 1.1;
        }

        location /socket.io/ {
                proxy_pass http://localhost:9000/socket.io/;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
        }
}
<!-- gh-comment-id:58811595 --> @asapach commented on GitHub (Oct 12, 2014): Here's an nginx config that seems to work for me: ``` server { listen 443; server_name example.com; ssl on; ssl_certificate /etc/nginx/ssl/server.crt; ssl_certificate_key /etc/nginx/ssl/server.key; location / { proxy_pass http://localhost:9000; proxy_http_version 1.1; } location /socket.io/ { proxy_pass http://localhost:9000/socket.io/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } } ```
Author
Owner

@zobrak commented on GitHub (Oct 13, 2014):

Actually I've got a "Cannot GET / " message when trying to browse the peerflix server.
in the console there is :
GET / 404 163ms
GET /favicon.ico 404 23ms
GET /favicon.ico 404 20ms
I have tried with both apache and nginx and I have this message...

<!-- gh-comment-id:58899617 --> @zobrak commented on GitHub (Oct 13, 2014): Actually I've got a "Cannot GET / " message when trying to browse the peerflix server. in the console there is : GET / 404 163ms GET /favicon.ico 404 23ms GET /favicon.ico 404 20ms I have tried with both apache and nginx and I have this message...
Author
Owner

@asapach commented on GitHub (Oct 13, 2014):

Does it work without a reverse proxy? Can you try and re-install peerflix-server?

<!-- gh-comment-id:58906013 --> @asapach commented on GitHub (Oct 13, 2014): Does it work without a reverse proxy? Can you try and re-install peerflix-server?
Author
Owner

@zobrak commented on GitHub (Oct 13, 2014):

I have uninstalled peerflix-server with "npm uninstall -g peerflix-server" and then reinstalled it.

Now it works fine but only with nginx. But no more with apache and the same 404 message.

I tried to link apache with nginx and 404 still here with apache. It should be as you said earlier a trouble with the way apache use url encoding or a misconfiguration on my server.

Thanks for help

<!-- gh-comment-id:58907310 --> @zobrak commented on GitHub (Oct 13, 2014): I have uninstalled peerflix-server with "npm uninstall -g peerflix-server" and then reinstalled it. Now it works fine but only with nginx. But no more with apache and the same 404 message. I tried to link apache with nginx and 404 still here with apache. It should be as you said earlier a trouble with the way apache use url encoding or a misconfiguration on my server. Thanks for help
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/peerflix-server#221
No description provided.