Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

Failed to accept video conversation when ROOT_URL set as http://domain.name/chat/rocketchat

Open ivesbai opened this issue 10 years ago • 5 comments

Your Rocket.Chat version: 0.20

for some reason, I should set my Rocket.Chat instance's ROOT_URL with a path,

export ROOT_URL=http://domain.name/chat/rocketchat

In a private group, I can start a video conversation,but when other group members accept this conversation, the page go white and the browse's URL become http://domain.name/chat/rocketchat/chat/rocketchat/group/private-group. And they can hear my voice. If I go another group or channel and then back the this private group, every thing goes right. the video can be seen and the voice can be heard.

ivesbai avatar Mar 02 '16 06:03 ivesbai

Are you using NGINX? Can you give more details about your deployment?

engelgabriel avatar Mar 03 '16 22:03 engelgabriel

Thanks for replay, Engelgabriel.

Yes, I deployed Rocket.Chat on a stand alone server with IP 192.168.148.15

export MONGO_URL=mongodb://localhost:27017/rocketchat export ROOT_URL=https://domain.com/chat/rocketchat export PORT=8000 node main.js &

and use NGINX as a proxy

upstream rocketchat { server 192.168.148.15:8000; }

location /chat/rocketchat { proxy_pass http://rocketchat; proxy_set_header Host 192.168.148.15; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } I do this for trickily integrate Rocket.Chat with my WordPress site and allow auto logon. Inject a login token into mongodb(it's not a good way, but work, I will explore how to use REST API for this if fessible).

There are other NGINX rewrite rules to fix URL problems: if ($request_uri ~* ^/(_timesync|avatar|___cookie__|assets|sounds|fonts|ufs|\.sandstorm-credentials|tap-i18n|favicon\.ico|images|recorderWorker\.js|packages)(.*)$) { rewrite ^/(_timesync|avatar|___cookie__|assets|sounds|fonts|ufs|\.sandstorm-credentials|tap-i18n|favicon\.ico|images|recorderWorker\.js|packages)(.*)$ /chat/rocketchat/$1$2 last; }

Thanks!

ivesbai avatar Mar 04 '16 02:03 ivesbai

@ivesbai can you explain how do you manage the autologin system from your wordpress ?

gtribut avatar Apr 18 '16 15:04 gtribut

@gtribut my solution is somehow a dirty hack way for quick demonstration.

  1. make rocket.chat under the same domain of wordpress
  2. use wordpress plugin to add user into rocket.chat by writing mongodb redirectly, a bad practice.
  3. use wordpress plugin to insert authToken into mongodb, also a bad practice.
  4. make authToken available for rocket.chat. just write authToken into javascript localStorage.

This is absolutely not the right way to figure out autologin. I will working on a normal way to realize wordpress autologin by oAuth. Here is my thinking:

  1. add an autologin setting to administration to make one of oAuths the default auth method.
  2. then the login page reads this setting and automatically redirect to the oAuth URL instead of clicking the oAuth icon.
  3. there is already a oAuth server plugins for wordpress, I tried WP OAuth Server, it seems not compatible with rocket.chat. I can write one if necessary. I can update you if I make any achievement if you have interests.

ivesbai avatar Apr 19 '16 01:04 ivesbai

@ivesbai thanks for the infos. I don't use wordpress, I will try to do something like you say for "a right way". But still interesting to know what you will achieve in the futur.

My problem is that I've never use meteor, so for the moment i'm a little bit lost, to find a starting point :) I will search on how is made existing rocket.chat oauth system.

gtribut avatar Apr 19 '16 10:04 gtribut