Created
September 26, 2018 17:00
-
-
Save johnstanfield/b664d151088ebeb21730f6260e0203ad to your computer and use it in GitHub Desktop.
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> | |
# suppose you have a SocketIO server running on port 8001 | |
# the first request uses the HTTP protocol, and its response instructs the client to use WebSockets | |
# subsequent requests are supposed to use the WebSocket protocol | |
# this is one way to have an Apache proxy the requests to SocketIO | |
# | |
# not sure if this is suitable for production use | |
# my production environment uses AWS Elastic Load Balancers, not Apache | |
# my dev and pen-test environments do use Apache, and this is how I make them work | |
RewriteEngine On | |
RewriteCond %{REQUEST_URI} ^/socket.io [NC] | |
RewriteCond %{QUERY_STRING} transport=polling [NC] | |
RewriteRule /(.*) http://localhost:8001/$1 [P,L] | |
RewriteCond %{REQUEST_URI} ^/socket.io [NC] | |
RewriteCond %{QUERY_STRING} transport=websocket [NC] | |
RewriteRule /(.*) ws://localhost:8001/$1 [P,L] | |
</VirtualHost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment