Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple URL to the same server #6899

Open
nathanmarcos opened this issue May 5, 2017 · 24 comments
Open

Multiple URL to the same server #6899

nathanmarcos opened this issue May 5, 2017 · 24 comments

Comments

@nathanmarcos
Copy link

nathanmarcos commented May 5, 2017

Hello guys,

We have an interesting use case that showed us a little problem, check the example bellow.

We have a server configured with the site URL as "https://weloverocketchat.com", in front of it, there's a proxy that allow users be able to access the server with different url's like "https://weloverocketchat.com.br", "https://loverocketchat.com", "https://rocketchatisthebest.com". Note that it is not a redirect because the browser should preserve the accessed url.

When we access the server with a different url that was configured, we got two little problems:

1) A warning popup to administrator.
image

2) An error when try to get some image from AWS S3 bucket:
The server response "403 Forbidden" when try GET {Site_URL}/file-upload/KfR8qJwaxxKWFAmrd/photo.jpg

As possible solutions suggestions, we can avoid this kind of verifications with the default site url, or make the "Site_URL" parameter a list.

What do you think about that?

Rocket.Chat Version: 0.49.3
Running Instances: 1
DB Replicaset OpLog: Enabled
Node Version: v4.5.0

@galindro
Copy link

galindro commented May 5, 2017

@engelgabriel

@k0nsl
Copy link
Contributor

k0nsl commented May 5, 2017

This is something I have been meaning to suggest as well since I run my instance in a similar manner; it is accessible from three different domains (.onion notwithstanding).

👍

@madguy02
Copy link
Contributor

madguy02 commented May 5, 2017

@rodrigok

@geekgonecrazy geekgonecrazy added the Feature: Request Requested Feature label May 5, 2017
@williamthiago
Copy link

Related to #2912

@florealcab
Copy link

I want this feature too. Any new about it?

@publicvirtualvoid
Copy link

This is quite an important feature to us, is there any way to make this work as it stands?

@rodrigok
Copy link
Member

@florealcab & @publicvirtualvoid have multiple URLs is not recommended, even if we change the file/avatar access to be relative to the current URL what happens when Rocket.Chat sends an email to the users containing a different URL (he will be redirected to a address where he is not logged in)?

Can you explain why you can't redirect the other URLs to your main URL?

@florealcab
Copy link

@rodrigok I think we can have a main URL and alternative ones. Mails are sent to the main URL, no problem for me (indeed if the user is logged with the other one, it should not work as you say but it's not a problem for me).

In my case, my main URL can be blocked on institutions using bad configured proxy, so I have an alternative URL which use a CDN to add a proxy between client and server. But I want to keep a direct connexion when all is working. That's why I have to use 2 URLs

@publicvirtualvoid
Copy link

The behaviour @florealcab suggested would work for us.

@rodrigok we want to change our main domain for certificate/SSL reasons but there are an unknown number of external integrations hitting the existing domain.

@shirosaki
Copy link

I need this feature. Different URL is used with intra site and internet site.
file-upload URL is absolute path using ROOT_URL. Relative path would be nice.

@LeeThompson
Copy link

LeeThompson commented Jan 23, 2019

This is an essential feature, especially in cases where the URL for intranet access is different from external.
Would also be helpful if you could wildcard the protocol (i.e. allow both http and https)

As for URLs in e-mail, could add a "PREFERRED URL" field for that purpose.

@rjozwiak
Copy link

rjozwiak commented Feb 1, 2019

Any updates since it was not released in 0.74.0 and January has already ended?

@tassoevan tassoevan modified the milestones: 0.74.0, Short-term Feb 17, 2019
@florealcab
Copy link

We are now up to the 1.1 version... any news about this feature ? @marceloschmidt

@renothing
Copy link

multiple url very usefull when you use rocket.chat as livechat service on multiple sites.

@florealcab
Copy link

In the latest version of Rocket Chat, I have not the warning anymore when I access with an URL other than the main one. So is it fixed?

@florealcab
Copy link

It's not true, I haven't it but it's back (without updating), so the problem is still unsolved. Hope it will be implemented soon...

@Angstroem
Copy link

Hello, is there any progress on this? I have a Rocket.Chat instance running with four different URLs. It all works fine with the Site URL unset, except the quotes, they only work from one URL. If a user quotes a message from a different URL that points to the Instance, but is not set with the Site URL, the quote will result in a message with a hyperlink.

Any suggestions on this are welcome ..

Screenshot 2020-11-19 193657

@LeeThompson
Copy link

I really wish they would allow multiple URL definitions.

For example, I need to somehow get the SSL reverse proxy working (I am currently using the web client on Android because the regular one now requires SSL) but I can't really test the reverse proxy and still have the old URL still work since the URL isn't quite the same.

@hazhayder
Copy link

Any update on this?

@LeeThompson
Copy link

There's an odd note in the documentation for setting up SSL and RocketChat (https://docs.rocket.chat/installation/manual-installation/configuring-ssl-reverse-proxy).

`

Note: You must use the outside https address for the value at ROOT_URL in [[Section 3|Deploy-Rocket.Chat-without-docker#3-download-rocketchat]] above. This includes the https:// and leave off the port number. So instead of ROOT_URL=http://localhost:3000 use something like https://your_hostname.com
`

This seems to conflict with what ROOT_URL supposedly does. (Also with my setup, https://your_hostname without the port number goes to a different SSL web-service.)

@andys448
Copy link

Any update on this?

URL for intranet access is different from external and quotes not working correctly :(

@WestXu
Copy link

WestXu commented Jun 17, 2021

I can't see why a site URL even exists. Why shouldn't all connections like download files all chained to the URL which was input by user in the first place?

@chenchk
Copy link

chenchk commented Jan 4, 2022

Any update on this?

@Shydlock
Copy link

Shydlock commented Jan 8, 2023

Find a solution:

  1. Admin Setting Panel -> General -> CDN_PREFIX

    And then your domain will become the new domain(instead of the site_url you set) you visit, but the "/vpn"(For example CDN_PREFIX=vpn) will be added at the beginning of your uri

    image-20230109002233087

  2. Rewrite your uri via reverse proxy like nginx, here I choose npm(Nginx proxy manager)

    image-20230109002111939

    Or in configration file use "proxy_pass" (⚠️ not "rewrite") like:

    Wrong Example:

    location ~* /vpn(.*){
    	set $myuri $1;
    	rewrite ^/ /$myuri? redirect; 
    }

    Right Example (Attention on the "proxy_pass"'s last "/' is required):

    location /vpn/{
    	proxy_set_header Host $host;
    	proxy_set_header  X-Real-IP        $remote_addr;
    	proxy_set_header  X-Forwarded-For  $proxy_add_x_forwarded_for;
    	proxy_set_header X-NginX-Proxy true;
    	proxy_pass [new_domain]/
    }
  3. And then your second domain will works fine

  4. Attention, you also need to add the uri rewrite to your first domain's reverse proxy same as step 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests