Apache Proxy Websocket Unexpected response code: 400 problem

Hello, I am having a problem with websocket. Can you help here? I installed rocketchat. I activated the required modules on Apache 2.4. I have defined the proxy rules but the error “failed: Error during WebSocket handshake: Unexpected response code: 400” is received. "

Server Setup Information

  • Version of Rocket.Chat Server: rocketchat-12.14.0
  • Operating System: Ubuntu 20.04
  • DB Replicaset Oplog:
  • NodeJS Version: v12.16.3
  • MongoDB Version: v4.0.18
  • Proxy Definitions

<Proxy *>
Order deny,allow
Allow from all

ProxyRequests Off
ProxyPreserveHost On
ProxyPass /chat 192.168.0.148:3000/chat
ProxyPassReverse /chat 192.168.0.148:3000/chat

<Location /chat>
Order allow,deny
Allow from all

RewriteEngine On

RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /var/www/(.*)           ws://192.168.0.10:3000/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket [NC]
RewriteRule /var/www/(.*)            192.168.0.10:3000/$1 [P,L]

RocketChat Service Definitions

Rocket Chat Environment
ROOT_URL=“http test.server.com chat”

ERRORS:

WebSocket connection to ‘wss://test.server.com/chat/sockjs/381/fj3jxqqr/websocket’ failed: Error during WebSocket handshake: Unexpected response code: 400

http:// I had to add http instead. Because while creating a topic, it gives maximum 2 permissions.

problem is solved.
<Proxy *>
Require all granted

AllowEncodedSlashes On

ProxyRequests Off
ProxyPreserveHost On

ProxyPass /chat http://192.168.0.10:3000/chat

<Location /chat>
Require all granted
RewriteEngine on
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]
RewriteRule .* ws://192.168.0.10:3000%{REQUEST_URI} [P]

ProxyPassReverse /chat 192.168.0.10:3000/chat

<Location /chat>
Require all granted