# Replace example.com with your domain and set RemoteIPInternalProxy ServerName example.com RewriteEngine On RewriteCond %{HTTP:Upgrade} =websocket [NC] RewriteRule /(.*) ws://127.0.0.1:3000/$1 [P,L] RewriteCond %{HTTP:Upgrade} !=websocket [NC] RewriteRule /(.*) http://127.0.0.1:3000/$1 [P,L] # Here we define the path to the WebSocket ProxyPass "/streaming" "ws://127.0.0.1:3000/streaming" ProxyPassReverse "/streaming" "ws://127.0.0.1:3000/streaming" ProxyRequests Off ProxyPreserveHost On Require all granted ProxyPass / http://127.0.0.1:3000/ ProxyPassReverse / http://127.0.0.1:3000/ RemoteIPHeader X-Forwarded-For RemoteIPHeader X-Real-IP # Set this to the (internal) IP of your proxy server RemoteIPInternalProxy 127.0.0.1 RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME} # Uncomment this if you are using SSL #RequestHeader set "X-Forwarded-SSL" expr=%{HTTPS} AllowEncodedSlashes On Require all granted