# RocketChat: Reverse proxy on other host

**URL:** <https://forums.rocket.chat/t/rocketchat-reverse-proxy-on-other-host/5102>\
**Category:** Community Support\
**Created:** [November 18, 2019, 9:07pm UTC](https://forums.rocket.chat/t/rocketchat-reverse-proxy-on-other-host/5102 "2019-11-18T21:07:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Florian.B](https://avatars.discourse-cdn.com/v4/letter/f/ecc23a/32.png) [@Florian.B](https://forums.rocket.chat/u/Florian.B)\
**Post date:** [November 18, 2019, 9:07pm UTC](https://forums.rocket.chat/t/rocketchat-reverse-proxy-on-other-host/5102/1 "2019-11-18T21:07:32Z")

</div>

### Description

I would like to host RocketChat on one server and my apache proxy on another (same local network). How to make the websocket work?  
I tried to modify the apache configuration but it doesn’t work. Is there an option to allow the websocket other than 127.0.0.1?  
Here is my configuration that I tried:

```auto
<VirtualHost *:80>
        Servername example

        RewriteEngine On
        RewriteCond %{HTTP:Upgrade} =websocket [NC]
        RewriteRule /(.*) ws://192.168.1.XX:3000/$1 [P,L]
        RewriteCond %{HTTP:Upgrade} !=websocket [NC]
        RewriteRule /(.*) http://192.168.1.XX:3000/$1 [P,L]

        ProxyPreserveHost On
        # exclude /.well-known/acme-challenge/ for let's encrypt renew
        ProxyPass /.well-known/acme-challenge/ !
        ProxyPass / http://192.168.1.XX:3000/
        ProxyPassReverse / http://192.168.1.XX:3000/

        ErrorLog /var/log/apache2/error.log
        CustomLog /var/log/apache2/access.log combined

</VirtualHost>

```

### Server Setup Information

- Version of Rocket.Chat Server: 2.1.1 stable
- Operating System: Ubuntu 18.04.3 LTS"
- Deployment Method: snap
- Proxy: apache

### Any additional Information

![firefox_5DNpkSSOyK](https://us1.discourse-cdn.com/flex021/uploads/rocketchat/original/2X/4/47f5440fc553f6d04a6786da198af31af292b9d4.png)

Translate: “Firefox cannot establish a connection with the server at the address wss://website/websocket”

I also tried to do a double reverse proxy:  
main reverse proxy -\> reverse apache proxy (on the same server as the snap version) -\> to the local RocketChat server

---

<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:** [November 20, 2019, 12:56pm UTC](https://forums.rocket.chat/t/rocketchat-reverse-proxy-on-other-host/5102/2 "2019-11-20T12:56:36Z")

</div>

I _think_ it is because you are trying to run this via http/80 but it really all want to be on https/443

Hence “wss”.

Apache should redirect all 80 -\> 443 and then reverse 443 -\> rocket:3000

See this:  
[https://rocket.chat/docs/installation/manual-installation/configuring-ssl-reverse-proxy/](https://rocket.chat/docs/installation/manual-installation/configuring-ssl-reverse-proxy/)

---

<div class="post-metadata">

**Author:** ![Florian.B](https://avatars.discourse-cdn.com/v4/letter/f/ecc23a/32.png) [@Florian.B](https://forums.rocket.chat/u/Florian.B)\
**Post date:** [January 9, 2020, 6:36pm UTC](https://forums.rocket.chat/t/rocketchat-reverse-proxy-on-other-host/5102/3 "2020-01-09T18:36:34Z")

</div>

I just tried to switch to https but I got the same result.

Isn’t there a setting in RocketChat to allow the websocket on a specific ip?

I think RocketChat only allows 127.0.0.1 to connect but I’m not sure.

> Servername example
> 
> ```
> SSLEngine on
> SSLCertificateFile /usr/local/etc/tls/example/fullchain.pem
> SSLCertificateKeyFile /usr/local/etc/tls/example/privkey.pem
> 
> RewriteEngine On
> RewriteCond %{HTTP:Upgrade} =websocket [NC]
> RewriteRule /(.*) ws://192.168.1.173:3000/$1 [P,L]
> RewriteCond %{HTTP:Upgrade} !=websocket [NC]
> RewriteRule /(.*) http://192.168.1.173:3000/$1 [P,L]
> 
> ProxyPreserveHost On
> # exclude /.well-known/acme-challenge/ for let's encrypt renew
> ProxyPass /.well-known/acme-challenge/ !
> ProxyPass / http://192.168.1.173:3000/
> ProxyPassReverse / http://192.168.1.173:3000/
> 
> ErrorLog /var/log/apache2/example-https-error.log
> CustomLog /var/log/apache2/example-https-access.log combined
> 
> ```

---

<div class="post-metadata">

**Author:** ![Florian.B](https://avatars.discourse-cdn.com/v4/letter/f/ecc23a/32.png) [@Florian.B](https://forums.rocket.chat/u/Florian.B)\
**Post date:** [January 10, 2020, 2:14pm UTC](https://forums.rocket.chat/t/rocketchat-reverse-proxy-on-other-host/5102/4 "2020-01-10T14:14:30Z")

</div>

I forgot to enable apache module “proxy\_wstunnel”, problem is solve.
