Apache Reverse Proxy with Subdirectory


Hey Guys,

i am trying to get a rocket.chat instance behind and Apache Reverse-Proxy running.
The Proxy is protected with an basic auth, which works fine.
The main problem is, that i have to run it in a subdirectory, which is not covered by the documentation.

So rocket.chat is configured on a dedicated VM:

Port 3000

The Reverse Proxy is configured as follows:

<Location /chat>
      RewriteEngine On
      RewriteCond %{HTTP:Upgrade} =websocket [NC]
      RewriteRule /chat/(.*)           ws://$1 [P,L]
      RewriteCond %{HTTP:Upgrade} !=websocket [NC]
      RewriteRule /chat/(.*) $1 [P,L]

     ProxyPass ""
     ProxyPassReverse ""

I can access rocket.chat via sub.domain.org/chat/ and can login!
But i see an error regarding:
with status code 401 Unauthorized.
Further no images (like avatars) are shown and i also get a 401 error.

If i remove the RewriteConds and Rewrite Rules i get 401 errors from the following


For every 401 error i get a login window from my basic auth, which is quite annoying…

What did i miss in my proxy config.

Thanks in advance!