# How to change ROOT\_URL environment variable when using snap version

**URL:** <https://forums.rocket.chat/t/how-to-change-root-url-environment-variable-when-using-snap-version/566>\
**Category:** Community Support\
**Created:** [April 11, 2018, 11:08pm UTC](https://forums.rocket.chat/t/how-to-change-root-url-environment-variable-when-using-snap-version/566 "2018-04-11T23:08:19Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![chucha](https://avatars.discourse-cdn.com/v4/letter/c/5daacb/32.png) [@chucha](https://forums.rocket.chat/u/chucha)\
**Post date:** [April 11, 2018, 11:08pm UTC](https://forums.rocket.chat/t/how-to-change-root-url-environment-variable-when-using-snap-version/566/1 "2018-04-11T23:08:20Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![frederik.t](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/frederik.t/32/167_2.png) [@frederik.t](https://forums.rocket.chat/u/frederik.t)\
**Post date:** [April 12, 2018, 11:44am UTC](https://forums.rocket.chat/t/how-to-change-root-url-environment-variable-when-using-snap-version/566/2 "2018-04-12T11:44:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![chucha](https://avatars.discourse-cdn.com/v4/letter/c/5daacb/32.png) [@chucha](https://forums.rocket.chat/u/chucha)\
**Post date:** [April 12, 2018, 2:52pm UTC](https://forums.rocket.chat/t/how-to-change-root-url-environment-variable-when-using-snap-version/566/3 "2018-04-12T14:52:28Z")

</div>

I am trying to run rocket.chat in a subfolder ([http://www.server.com/chat](http://www.server.com/chat)) but just changing this parameter using the web interface does not work, clients always look for things in root directory.

---

<div class="post-metadata">

**Author:** ![aaron.ogle](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/aaron.ogle/32/15_2.png) [@aaron.ogle](https://forums.rocket.chat/u/aaron.ogle)\
**Post date:** [May 31, 2018, 8:09pm UTC](https://forums.rocket.chat/t/how-to-change-root-url-environment-variable-when-using-snap-version/566/4 "2018-05-31T20:09:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![LittleNo](https://avatars.discourse-cdn.com/v4/letter/l/ea5d25/32.png) [@LittleNo](https://forums.rocket.chat/u/LittleNo)\
**Post date:** [April 25, 2019, 2:35pm UTC](https://forums.rocket.chat/t/how-to-change-root-url-environment-variable-when-using-snap-version/566/5 "2019-04-25T14:35:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![reetp](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/reetp/32/5546_2.png) [@reetp](https://forums.rocket.chat/u/reetp)\
**Post date:** [April 25, 2019, 3:00pm UTC](https://forums.rocket.chat/t/how-to-change-root-url-environment-variable-when-using-snap-version/566/6 "2019-04-25T15:00:52Z")

</div>

> [@LittleNo](#):
>
> any news on this one?

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

> **[Deploy with Snaps](https://docs.rocket.chat/deploy/deploy-rocket.chat/deploy-with-snaps)**

---

<div class="post-metadata">

**Author:** ![scooke](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/scooke/32/1090_2.png) [@scooke](https://forums.rocket.chat/u/scooke)\
**Post date:** [June 30, 2019, 5:20pm UTC](https://forums.rocket.chat/t/how-to-change-root-url-environment-variable-when-using-snap-version/566/7 "2019-06-30T17:20:32Z")

</div>

@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!

---

<div class="post-metadata">

**Author:** ![aaron.ogle](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/aaron.ogle/32/15_2.png) [@aaron.ogle](https://forums.rocket.chat/u/aaron.ogle)\
**Post date:** [June 30, 2019, 7:56pm UTC](https://forums.rocket.chat/t/how-to-change-root-url-environment-variable-when-using-snap-version/566/8 "2019-06-30T19:56:39Z")

</div>

So you can override ROOT\_URL using the option from FAQ or can set via:

```auto
sudo snap set rocketchat-server siteurl=https://yoursiteurl.com

```

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?

---

<div class="post-metadata">

**Author:** ![jayvee](https://avatars.discourse-cdn.com/v4/letter/j/eb8c5e/32.png) [@jayvee](https://forums.rocket.chat/u/jayvee)\
**Post date:** [February 18, 2020, 11:51am UTC](https://forums.rocket.chat/t/how-to-change-root-url-environment-variable-when-using-snap-version/566/9 "2020-02-18T11:51:44Z")

</div>

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 😃

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 `https://your_hostname.com`

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=[https://your.domain.com/chat/](https://your.domain.com/chat/) 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](https://github.com/RocketChat/Rocket.Chat/pull/12351) says

> Added snap folder with hooks to configure ROOT\_URL […]

This very page says

```auto
sudo snap set rocketchat-server siteurl=https://yoursiteurl.com

```

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!

```auto
$ snap set rocketchat-server siteurl="https://my.dome.in/chat"
$ 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
siteurl
snap-refreshing false

```

siteurl is empty!

When I open `https://my.dome.in/chat`, 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.

---

<div class="post-metadata">

**Author:** ![zdelfw](https://avatars.discourse-cdn.com/v4/letter/z/dec6dc/32.png) [@zdelfw](https://forums.rocket.chat/u/zdelfw)\
**Post date:** [February 18, 2020, 3:08pm UTC](https://forums.rocket.chat/t/how-to-change-root-url-environment-variable-when-using-snap-version/566/10 "2020-02-18T15:08:26Z")

</div>

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`
- `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. 🤔

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

---

<div class="post-metadata">

**Author:** ![lucasbasquerotto](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/lucasbasquerotto/32/1792_2.png) [@lucasbasquerotto](https://forums.rocket.chat/u/lucasbasquerotto)\
**Post date:** [September 13, 2021, 8:14pm UTC](https://forums.rocket.chat/t/how-to-change-root-url-environment-variable-when-using-snap-version/566/11 "2021-09-13T20:14:05Z")

</div>

> [@zdelfw](#):
>
> I’ll be looking into the code to see how siteurl is set

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).

---

<div class="post-metadata">

**Author:** ![eravid](https://avatars.discourse-cdn.com/v4/letter/e/a87d85/32.png) [@eravid](https://forums.rocket.chat/u/eravid)\
**Post date:** [October 27, 2021, 10:19am UTC](https://forums.rocket.chat/t/how-to-change-root-url-environment-variable-when-using-snap-version/566/12 "2021-10-27T10:19:07Z")

</div>

I’m experiencing the same issue since I want to use rocket chat behind a nginx reverse proxy to use SSL.[.](https://get-vidmate.com) [.](https://instasave.onl/)

---

<div class="post-metadata">

**Author:** ![YardCamel](https://avatars.discourse-cdn.com/v4/letter/y/73ab20/32.png) [@YardCamel](https://forums.rocket.chat/u/YardCamel)\
**Post date:** [December 17, 2021, 7:29pm UTC](https://forums.rocket.chat/t/how-to-change-root-url-environment-variable-when-using-snap-version/566/13 "2021-12-17T19:29:06Z")

</div>

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.
