DirectoryIndex ""
RewriteEngine On

RewriteCond %{REQUEST_URI} ^/ [NC]
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
RewriteRule .* ws://127.0.0.1:3000%{REQUEST_URI} [P,QSA,L]

RewriteCond %{REQUEST_URI} ^/ [NC]
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule .* http://127.0.0.1:3000%{REQUEST_URI} [P,QSA,L]