RocketChat / Rocket.Chat

The communications platform that puts data protection first.
https://rocket.chat/
Other
40.09k stars 10.35k forks source link

Generated discussion invitation link doesn't work for RC hosted in sub-directory #16976

Open JoshMcCullough opened 4 years ago

JoshMcCullough commented 4 years ago

Description:

The invite URL generated from a discussion is incorrect. (URls below have been decoded for clarity.)

Steps to reproduce:

  1. go to a discussion
  2. click the Members List
  3. click Invite Users
  4. copy the generated link
  5. paste the link in a new tab
  6. 404 is shown because URL has "chat/" in it twice

Expected behavior:

URL should not include the sub-directory in the path parameter, and should be: https://go.rocket.chat/?host=www.mysite.net/chat&path=invite/LTrzj3

Actual behavior:

URL generated is https://go.rocket.chat/?host=www.mysite.net/chat&path=chat/invite/LTrzj3 (path starts with chat/, which is redundant).

Server Setup Information:

Client Setup Information

Additional context

We host RC in a sub-directory and have a proxy server in front of RC. Note that changing the Site URL to "https://www.mysite.net" (removing "/chat") via the setting in Administration > General fixes this issue, but leads to another, and also I'm not sure where else this setting is used or what may break since it no longer points to the actual RC app.

github-actions[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

JoshMcCullough commented 4 years ago

This is still an issue. In fact, when generating a link to invite a user to a discussion, the URL is point to https://go.rocket.chat/invite?host=example.com%2Fchat&path=chat%2Finvite%2F6EoidP

  1. why is this routed through rockethttps://go.rocket.chat at all?
  2. the host parameter includes the path, which is then also included in the path parameter (so it doesn't work)
pierre-lehnen-rc commented 4 years ago

You can disable the url proxy on Admin -> Accounts -> Registration -> Invite URL Type

JoshMcCullough commented 4 years ago

Thank you. Did that just now and it is better, however the path is duplicated, e.g. I get "https://blah.com/chat/chat/..." instead of "https://blah.com/chat/...".

Stift commented 4 years ago

I can confirm that the issue still exists (RC 3.3.3). The problem seems to be in app/utils/lib/getURL.js when the site_url gets concatenated with the meteor_runtime_config.ROOT_URL_PATH_PREFIX. I'm confused by the missing distinction of env:ROOT_URL and the settings Site_Url and Site_Url_DeepLink. As I changed SIte_Url and remove the path this leads to a wrong SAML config as the some values in the SAML custom issuer response are wrong then.

github-actions[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

JoshMcCullough commented 3 years ago

Still an issue.

3ronco commented 2 years ago

Stumbled over this and "Invite URL Type" still doesn't honor the Direct setting. You may set it to that value but creating an Invite link is still: https://go.rocket.chat/invite?...

Version 4.8.1 Apps Engine Version 1.32.0 Node Version v14.18.3 Database Migration 265 (June 26, 2022 12:57 PM) MongoDB 5.0.9 / unknown (oplog Enabled) Commit Details HEAD: (0b106e364)