strukturag / spreed-webrtc

WebRTC audio/video call and conferencing server.
GNU Affero General Public License v3.0
1.09k stars 259 forks source link

Websocket apache2 reverse proxy error #403

Open kstawiski opened 7 years ago

kstawiski commented 7 years ago

Hi! I have encountered strange error with spreed-webrtc and owncloud. I have ssl-protected apache2 webhost with setup reverse proxy to webrtc like this:

FcgidMaxRequestLen 2621440000
FcgidConnectTimeout 600

RewriteEngine   on
RewriteCond     %{HTTPS} !=on
RewriteRule     ^(.*)$ https://%{HTTP_HOST}/$1 [L,R]

KeepAlive On
KeepAliveTimeout 100
MaxKeepAliveRequests 200
Header always set Strict-Transport-Security "max-age=15768000; includeSubDomains; preload"

<Location /webrtc>
        ProxyPass http://127.0.0.1:8080/webrtc
        ProxyPassReverse /webrtc
    </Location>

    <Location /webrtc/ws>
        ProxyPass ws://127.0.0.1:8080/webrtc/ws

    </Location>

    ProxyVia On
    ProxyPreserveHost On
    RequestHeader set X-Forwarded-Proto 'https' env=HTTPS

Chat and app in general seems to work, but calls disconnects after picking up and one cannot for example send a file in chat (the file is uploaded but cannot be downloaded by recipent). It seems like a problem with websocket forwarding but I cannot diagnose one.

Log in console is looking like this:

server 2016/12/06 22:06:32.736393 First session registered for user tomasik
server 2016/12/06 22:06:32.736406 Authentication success tomasik
server 2016/12/06 22:06:32.736478 Created new session token 572 MTQ4MTA1ODM5MnxVcHk1WTJzYTlvcnF1ajlSYkRsRHphS29OTzNNSmp6dE50a0hQT2pKMkdEVU1CSnF2bXMtT0l2bllCZlo1T2N1UUxNMnVUMU0yT3Fnc1JOT2lXY2pSZlZUajk0NnVsNFgzSlEwTlI4dHRObTJCX3JRQTZHUGxNal80MHN2WURfZ3RyVUhrWlM3RnBSdHU3QWNvZ2d3ejZ6c0lFeGtkQ29yOWRGU3dxMlZyMTFDVUxtX3RMbmVlQVlidm5yUHN0bWs0VGR1TTEyQmdHMzZ5aFZVbG9nMEpGVENRdzltYzJFa1pTMlVjZ3Q5YllNUlZieVFab19zLXlBRUVuUnh5Ym14MmR4aGV3eVBTWEFXS0RZdU9NZmQyWTRDT2RpT28wYmFTY2Q3OXF0aTRiOS00aERKYnBGbG9oVmRfZmVZdkN6dXIzdWxLQi1QYlg0bTRXQzAzU1RVTnVURW9vVlBUVF9maGh6UnJOU2NMWjFHaDZfTExDcnd2OGkxU3pGZXNRPT187-MQRpvniCqqeto9dMKGnVTfv1GLAT6xnsKJsRHG83M=
server 2016/12/06 22:10:04.708863 Creating worker for room 'Room:pok1'
server 2016/12/06 22:11:24.297373 Room worker not in use - cleaning up 'Room:'
server 2016/12/06 22:11:24.297408 Cleaned up room 'Room:'
server 2016/12/06 22:13:53.421438 Error while reading 14 websocket: close 1001 (going away)
server 2016/12/06 22:13:53.421640 Last session unregistered for user tomasik

Best wishes, Konrad

leonklingele commented 7 years ago

Which version of Apache are you using? Did you enable all required Apache modules ($ a2enmod proxy proxy_http proxy_wstunnel headers)?

kstawiski commented 7 years ago

Thank you very much for your interest. The version is up to date and modules are enabled.

konrad@gen:~$ apache2 -v
Server version: Apache/2.4.18 (Ubuntu)
Server built:   2016-07-14T12:32:26
konrad@gen:~$ a2enmod proxy proxy_http proxy_wstunnel headers
Module proxy already enabled
Considering dependency proxy for proxy_http:
Module proxy already enabled
Module proxy_http already enabled
Considering dependency proxy for proxy_wstunnel:
Module proxy already enabled
Module proxy_wstunnel already enabled
Module headers already enabled

I have also noticed that there are no icons shown.

image

I tried to change ws:// to wss:// and therefore reconfigured server config. However no change occured. I'm able to chat but not to send files and one can pick up a call but it gets diconnected just after picking up. Any ideas why?

Cheers, Konrad

leonklingele commented 7 years ago

Please check the developer console of your browser:

  1. Open the Spreed.ME app in Nextcloud
  2. Append ?debug to the URL, i.e. https://domain.com/index.php/apps/spreedme/?debug
  3. Now open your browser’s dev console:
  4. Right click on the Nextcloud site
  5. Click "Inspect element" (very bottom)
  6. Check what it says in the console and paste it here
coolmodi commented 7 years ago

Same problem here, chat works, app works, I can call myself from 2 different pcs with 2 different accounts fine (same ip), but calling a friend to test it with will just hang up instantly.

Error while reading 20 websocket: close 1001 (going away)

No error in apache logs.

RcrdBrt commented 7 years ago

I have Nginx configured as a reverse-proxy, same issue of @coolmodi. I can call myself from the same IP flawlessly but I have Error while reading 2 websocket: close 1001 (going away) in the spreed server logs when trying to communicate from different addresses.

Any news on this problem?

tarator commented 7 years ago

Same here. I have installed spreed as a Docker Container. Videocalls work fine when using Spreed with two devices which are in the same private network (LAN).

Did anybody solve the problem?

Console in the browser gives me following warning/error when using the ?debug parameter:

onaddstream is deprecated! Use peerConnection.ontrack instead.
RTCSessionDescription's members are readonly! Writing to them is deprecated and will break soon!  
ICE failed, add a STUN server and see about:webrtc for more details (unbekannt)

I also tried to enable debugging in about:webrtc (Firefox 53.0 on Kubuntu 16.04) but the generated file /tmp/WebRTC.log stays empty after the call fails.

ghost commented 7 years ago

Got the same error here. Tried from different machines, different operating systems, different browsers even different nextcloud servers. Same result. Call got hung up 2sec after it is established. Firebug shows nothing. Seems to be a bigger problem, no?

ghost commented 7 years ago

Seems i got it working by adding:

stunURIs = stun:stun.spreed.me:443

to the spreed-webrtc config.

tarator commented 7 years ago

@himbeere in which file did you add the line stunURIs = stun:stun.spreed.me:443 Doesn't that mean that you are connecting to a different server (a server which is operated by spreed.me)? This makes it useless somehow to install Spreed on your own server, or am I missing something here?

ghost commented 7 years ago

@tarator This options goes to the spreed-webrtc config file under [app]. As for your other question. You can run your own stun server. For example stuntman: http://www.stunprotocol.org/. What an stun server does is explained in the RFC: http://www.ietf.org/rfc/rfc3489.txt

tarator commented 7 years ago

@himbeere thanks for clarification. It worked for me with adding the following stun-server to my spreed-me.conf

[app]
....
stunURIs = stun:stun.stunprotocol.org:3478
....

Maybe I will try to set up my own stun server another time.