I have a ratchet chat server file
use Ratchet\\Server\\IoServer;
use Ratchet\\WebSocket\\WsServer;
use MyAppChat\\Chat;
require dirname(__DIR__) . \'/vendor/
I was trying to do this for a subdomain. Ex: Redirect realtime.domain.org to localhost:8080 from apache.
Here's how it worked. You can create a virtual host and proxy pass that.
ServerName realtime.domain.org
RewriteEngine On
RewriteCond %{HTTP:Connection} Upgrade [NC]
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteRule /(.*) ws://localhost:8080/$1 [P,L]
ProxyPreserveHost On
ProxyRequests off
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
So, all the requests to realtime.domain.org can be redirected to port 8080, where you can run the WebSocket handler.