schlagmichdoch / PairDrop

PairDrop: Local file sharing in your browser. Inspired by Apple's AirDrop. Fork of Snapdrop.

Home Page:https://pairdrop.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Devices on the same network doesn't detect each other

infocillasas opened this issue · comments

Hi @schlagmichdoch

I'm experiencing issues related topic #24 . Frontend app is OK, I can pair some devices on the same network but devices don't show when I just land on the homepage. It works perfectly on pairdrop.net.

I suppose there is something to do with my apache proxy.

My Setup: selhosted on a bare metal Debian server with Docker (I intentionnaly disactivated the coturn part, is that OK)
The host port is 3082 as the port 3000 is already used. Here the section of the docker-compose file:

ports:
      - "127.0.0.1:3082:3000"

My apache config looks like this:

<VirtualHost *:80>
   ServerName mydomain

Redirect permanent / https://mydomain/

</VirtualHost>

<VirtualHost *:443>
   ServerName mydomain

ProxyPass / http://127.0.0.1:3082/

RewriteEngine On
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/?(.*) "ws://127.0.0.1:3082/$1" [P,L]

SSLCertificateFile /etc/letsencrypt/live/xxx.pem
SSLCertificateKeyFile /etc/letsencrypt/live/xxx.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>

It doesn't work if I put "https" in the ProxyPass section as mentionned in the documentation (lots of ssl errors in apache's logs) and also if I put "wws://" in the websocket section of the apache config, it doesn't work.

With the above setup it works but devices on the same network are not detected automatically. I can force the pairing with the 6 digits code, that's it.

Could you help me ?

Another issue is that the coturn docker container doesn't start up correctly. It continuously starts (see screenshot below)

image

Originally posted by @infocillasas in #24 (comment)

I'm trying to use PairDrop on an internal network that spans multiple 10.0.0.0/16 networks. X-Forwarded-For is correctly reporting the 10.x.y.z IP for clients, but ipIsPrivate assumes all private IPs are on the same network.

I don't know enough to suggest a good solution, but a good solution does seem difficult.

Just wanted to add my (hopefully not unique) use case for potential consideration.

Hi,
Pulling the latest version now works on my side on private network and public temporary room and connected devices... I would be curious to understand what was changed !
Thanks
Romain

@infocillasas I'm sorry I have overlooked your original comment. I guess this was because the original issue was closed already. I guess it's better to create a new issue referencing the old issue, so I'll always find it when looking for open issues.

@Skinner927 Same thing for you. Always create a new issue otherwise your comment will likely have the same fate as @infocillasas 's. I believe you want to only use public rooms and pairing in your setup? Then I'd think a feature to switch off the automatic private IP detection would suffice. You're welcome to create a feature request for that.

@infocillasas
Great that it works for you now! Does everything work including the start of the coturn container?

I would be curious to understand what was changed !

Interestingly, nothing has changed on the server side: https://github.com/schlagmichdoch/PairDrop/commits/master/?since=2024-04-18&until=2024-07-01
I'm not sure what made this work for you in the end. Did you maybe forget to do an apache reload and later restarted the server?

It doesn't work if I put "https" in the ProxyPass section as mentionned in the documentation (lots of ssl errors in apache's logs) and also if I put "wws://" in the websocket section of the apache config, it doesn't work.

I'm sorry the docs were not correct for the Apache config!
Can you confirm, that the corrected version you provided is working? Then I would either fix the docs or (if you want to be a contributor) I would merge a PR if you provided one.

Which Apache version are you running?
Apparently, since Apache version 2.4.47, instead of using the Rewrite module, you can also just use the following:

ProxyPass / http://127.0.0.1:3082/ upgrade=websocket

(see https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#examples)

I intentionnaly disactivated the coturn part, is that OK

You would only need that for most internet transfers. When using your PairDrop instance on the same network, everything should work. See hosting documentation and technical documentation

@infocillasas Great that it works for you now! Does everything work including the start of the coturn container?

I would be curious to understand what was changed !

At the time I wrote this it was working in my Office's private network and my 1st tests were done at Home, where it still doesn't work...
So what changed is the location ! I don't understand why it doesn't work at home, as it is a very basic network without firewall, proxy, etc.

Would it be possible to reopen the issue ?

Interestingly, nothing has changed on the server side: https://github.com/schlagmichdoch/PairDrop/commits/master/?since=2024-04-18&until=2024-07-01 I'm not sure what made this work for you in the end. Did you maybe forget to do an apache reload and later restarted the server?

See above

It doesn't work if I put "https" in the ProxyPass section as mentionned in the documentation (lots of ssl errors in apache's logs) and also if I put "wws://" in the websocket section of the apache config, it doesn't work.

I'm sorry the docs were not correct for the Apache config! Can you confirm, that the corrected version you provided is working? Then I would either fix the docs or (if you want to be a contributor) I would merge a PR if you provided one.

Yes I confirm

Which Apache version are you running? Apparently, since Apache version 2.4.47, instead of using the Rewrite module, you can also just use the following:

ProxyPass / http://127.0.0.1:3082/ upgrade=websocket

I'm running Apache 2.4.61, I'll try the above config and keep you posted.

I intentionnaly disactivated the coturn part, is that OK

You would only need that for most internet transfers. When using your PairDrop instance on the same network, everything should work. See hosting documentation and technical documentation

Ok, I'll look into it, thanks a lot @schlagmichdoch

Sure I’ll reopen this. thanks for the information!

Are your home and office cases two different PairDrop instances? What exactly does not work at home? Is the ws connection „loading“? Does the automatic grouping work? Does pairing work?

Are your home and office cases two different PairDrop instances? What exactly does not work at home? Is the ws connection „loading“? Does the automatic grouping work? Does pairing work?

Now it works
I had a "ProxyPassReverse" command in my Apache VirtualHost config. After removing it, it works perfectly on all networks.

Thanks a lot @schlagmichdoch !

My current (working) Apache config is:

<VirtualHost *:80>
   ServerName mydomain

Redirect permanent / https://mydomain

</VirtualHost>

<VirtualHost *:443>
   ServerName mydomain

ServerSignature Off

   ProxyPass / http://localhost:3082/ upgrade=websocket

Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/mydomain/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/mydomain/privkey.pem
</VirtualHost>