How to change ROOT_URL environment variable when using snap version

Hello there!, I just installed Rocket.Chat on an Ubuntu 16.04 server using snaps… I am new to snaps and needed to know how the environmental variables work when using snaps… need to change ROOT_URL.

Any help appreciated!

Did you run into an error, or is it just because you want to?

I am trying to run in a subfolder ( but just changing this parameter using the web interface does not work, clients always look for things in root directory.

Currently not possible. We do plan to allow that in the future.

any news on this one? I’m experiencing the same issue since I want to use rocket chat behind a nginx reverse proxy to use SSL. My setup is on Ubuntu 18.04 as a snap.

Yup - it is in the documentation, and there are closed Issues in github telling you about it.

@reetp There is nothing on page you linked to which tells a new user how to change the site url. If you know there actually are sites with the requested info please post the link to those sites please. I’ve been looking too for quite awhile!

So you can override ROOT_URL using the option from FAQ or can set via:

sudo snap set rocketchat-server siteurl=

The change I mentioned before was added making this possible

We should definitely get this added to the documentation.

Cc: @lucia.guevgeozian I think this might be in the ssl stuff, but maybe we need to call out some of the other variables like this that can now be set in the FAQ?


The documentation really needs some work. I’ve been trying to get this to work for hours. Please forgive the tone of the remainder of this post. I’m pretty frustrated. Aaaand I’m not allowed to post more than two links in my first post :smiley:

Configuring SSL Reverse Proxy (docs/installation/manual-installation/configuring-ssl-reverse-proxy/ says:

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

The layout seems broken, and I can’t find “Section 3”. No mention about paths - there should also be a link to Running in a sub folder with Apache (docs/installation/manual-installation/running-in-a-sub-folder/). That page says

To run in a subfolder you should pass the environment variable ROOT_URL to the process. For example:
ROOT_URL= node main.js

But it doesn’t explain how to do that.

The page on Snaps (docs/installation/manual-installation/ubuntu/snaps/#how-do-i-change-other-environmental-variables-in-my-snap) doesn’t explain how to change the ROOT_URL either.

The GitHub PR #12351 says

Added snap folder with hooks to configure ROOT_URL […]

This very page says

sudo snap set rocketchat-server siteurl=

What’s the difference between siteurl and ROOT_URL? Are these the same?

When I try this though, the config doesn’t seem to stick!

$ snap set rocketchat-server siteurl=""
$ snap get rocketchat-server
Key                               Value
backup-on-refresh                 disable
caddy                             disable
db-feature-compatibility-version  3.6
https                             disable
mongo-oplog-url                   mongodb://localhost:27017/local
mongo-url                         mongodb://localhost:27017/parties
port                              3000
snap-refreshing                   false

siteurl is empty!

When I open, the first request is served. But the rest of the resources are fetched from /... instead of /chat/..., presumably because the server isn’t aware of its URL.

I’ve been running into this exact same issue as well and made a post about this yesterday–I’m glad someone else is running into issues (it’s validating). I’ll be looking into the code to see how siteurl is set.

EDIT: I’m currently looking at all of the environment variables that are used in Rocket.Chat. I see

  • ROOT_URL_PATH_PREFIX (a part of __meteor_runtime_config__, mentioned in several places like app/cas/server/cas_client.js)… I wonder if setting this solves our issues. :thinking:

EDIT: Setting ROOT_URL_PATH_PREFIX to chat does not work in my example.

1 Like

A bit late, but I had the same issue and solved it now. The problem is actually a lack of documentation (or at least a lack of a clear documentation).

You can see the Site URL setting in the admin section General. Alternatively, you can define the environment variable Site_Url to set it (or OVERWRITE_SETTING_Site_Url to make sure that the environment variable is always applied).

I’m experiencing the same issue since I want to use rocket chat behind a nginx reverse proxy to use SSL.. .

Did anyone ever figure this out? I’m also trying to run Rocket.Chat from a snap behind a reverse proxy. I have set the Site Url value in the admin interface under General to http://{ip address}:3000/chat

Hitting the server directly from inside the network, the server keeps telling me that it’s set to /chat but that it’s serving from /

Hitting it from outside via the reverse proxy I get no response.

Thanks in advance. I’ll update here with links if I find the solution.