The following syntax can be used to run websocket connections in Apache in a subfolder :
# /websocket1 to port 2085
RewriteCond %{REQUEST_URI} /websocket1 [NC]
RewriteCond %{HTTP:Upgrade} "(?i)websocket" [NC,OR]
RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
RewriteRule ^/(.*)$ ws://127.0.0.1:2085/$1 [P,QSA,L]
# /websocket2 to port 3126
RewriteCond %{REQUEST_URI} /websocket2 [NC]
RewriteCond %{HTTP:Upgrade} "(?i)websocket" [NC,OR]
RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
RewriteRule ^/(.*)$ ws://127.0.0.1:3126/$1 [P,QSA,L]
The above need to be used in a SSL virtualhost.
For a non-SSL virtualhost, one can simply use:
ProxyPass "/websocket1" "ws://127.0.0.1:2085/"
ProxyPass "/websocket2" "ws://127.0.0.1:3126/"
No comments:
Post a Comment