Created
December 27, 2014 22:23
-
-
Save iacchus/78c633a803d3c711b171 to your computer and use it in GitHub Desktop.
Set reverse proxy websockets in Apache 2.4 using socket.io 1.0. Needs mod_rewrite module, this version doesn't uses SSL. As seen here https://serverfault.com/questions/616370/configuring-apache-2-4-mod-proxy-wstunnel-for-socket-io-1-0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost *:80> | |
ServerName forum.example.com | |
# ServerAdmin webmaster@localhost | |
<Proxy *> | |
Require all granted | |
</Proxy> | |
ProxyRequests off | |
ProxyVia on | |
RewriteEngine On | |
RewriteCond %{REQUEST_URI} ^/socket.io [NC] | |
RewriteCond %{QUERY_STRING} transport=websocket [NC] | |
RewriteRule /(.*) ws://localhost:4567/$1 [P,L] | |
ProxyPass /socket.io http://localhost:4567/socket.io | |
ProxyPassReverse /socket.io http://localhost:4567/socket.io | |
<Location /> | |
ProxyPass http://127.0.0.1:4567/ | |
ProxyPassReverse http://127.0.0.1:4567/ | |
</Location> | |
ErrorLog /home/username/logs/apache/forum-error.log | |
CustomLog /home/username/logs/apache/forum-access.log combined | |
</VirtualHost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment