# Passenger/cPanel Node.js configuration
PassengerAppType node
PassengerStartupFile server.js

# Enable WebSocket support
RewriteEngine On
RewriteCond %{REQUEST_URI}  ^/socket.io            [NC]
RewriteCond %{QUERY_STRING} transport=websocket    [NC]
RewriteRule /(.*)           ws://localhost:%{ENV:PORT}/$1 [P,L]

# Redirect all requests to Node.js app
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://localhost:%{ENV:PORT}/$1 [P,QSA,L]
