{"action":"created","issue":{"url":"https://api.github.com/repos/Automattic/socket.io/issues/1696","labels_url":"https://api.github.com/repos/Automattic/socket.io/issues/1696/labels{/name}","comments_url":"https://api.github.com/repos/Automattic/socket.io/issues/1696/comments","events_url":"https://api.github.com/repos/Automattic/socket.io/issues/1696/events","html_url":"https://github.com/Automattic/socket.io/issues/1696","id":38943124,"number":1696,"title":"Apache 2.4 ProxyPass Configuration","user":{"login":"ChiperSoft","id":231157,"avatar_url":"https://avatars.githubusercontent.com/u/231157?v=3","gravatar_id":"","url":"https://api.github.com/users/ChiperSoft","html_url":"https://github.com/ChiperSoft","followers_url":"https://api.github.com/users/ChiperSoft/followers","following_url":"https://api.github.com/users/ChiperSoft/following{/other_user}","gists_url":"https://api.github.com/users/ChiperSoft/gists{/gist_id}","starred_url":"https://api.github.com/users/ChiperSoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChiperSoft/subscriptions","organizations_url":"https://api.github.com/users/ChiperSoft/orgs","repos_url":"https://api.github.com/users/ChiperSoft/repos","events_url":"https://api.github.com/users/ChiperSoft/events{/privacy}","received_events_url":"https://api.github.com/users/ChiperSoft/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":17,"created_at":"2014-07-28T23:12:08Z","updated_at":"2015-05-04T12:20:49Z","closed_at":"2014-11-25T17:15:46Z","body":"With 0.9 I was able to proxy our websockets through Apache 2.4 using the following config:\r\n\r\n```\r\nProxyPass /socket.io/1/websocket ws://localhost:8082/socket.io/1/websocket\r\nProxyPassReverse /socket.io/1/websocket ws://localhost:8082/socket.io/1/websocket\r\n\r\nProxyPass /socket.io/ http://localhost:8082/socket.io/\r\nProxyPassReverse /socket.io/ http://localhost:8082/socket.io/\r\n```\r\n\r\nI'm attempting to migrate to 1.0.6 now and I immediately noticed that the socket endpoint changed, but updating the ProxyPass config like so does not seem to do the trick.\r\n\r\n```\r\nProxyPass /socket.io/?EIO=2&transport=websocket ws://localhost:8082/socket.io/?EIO=2&transport=websocket\r\nProxyPassReverse /socket.io/?EIO=2&transport=websocket ws://localhost:8082/socket.io/?EIO=2&transport=websocket\r\n\r\nProxyPass /socket.io/ http://localhost:8082/socket.io/\r\nProxyPassReverse /socket.io/ http://localhost:8082/socket.io/\r\n```\r\n\r\nChrome reports over and over again that it receives a 400 error when trying to open the websocket.  There's no output in the console on the server to indicate that any connection attempt was received (DEBUG=socket.io).\r\n\r\nIs there some other configuration factor that I need for this to work?"},"comment":{"url":"https://api.github.com/repos/Automattic/socket.io/issues/comments/98691128","html_url":"https://github.com/Automattic/socket.io/issues/1696#issuecomment-98691128","issue_url":"https://api.github.com/repos/Automattic/socket.io/issues/1696","id":98691128,"user":{"login":"p-afraz","id":4385709,"avatar_url":"https://avatars.githubusercontent.com/u/4385709?v=3","gravatar_id":"","url":"https://api.github.com/users/p-afraz","html_url":"https://github.com/p-afraz","followers_url":"https://api.github.com/users/p-afraz/followers","following_url":"https://api.github.com/users/p-afraz/following{/other_user}","gists_url":"https://api.github.com/users/p-afraz/gists{/gist_id}","starred_url":"https://api.github.com/users/p-afraz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/p-afraz/subscriptions","organizations_url":"https://api.github.com/users/p-afraz/orgs","repos_url":"https://api.github.com/users/p-afraz/repos","events_url":"https://api.github.com/users/p-afraz/events{/privacy}","received_events_url":"https://api.github.com/users/p-afraz/received_events","type":"User","site_admin":false},"created_at":"2015-05-04T12:20:49Z","updated_at":"2015-05-04T12:20:49Z","body":"Tnx guys, I managed to setup an Apache 2.4.9 load balancer for socket io 1.3.5, but the problem is with \"Session Affinity\". Sticky sessions just don't work with this approach. When I've got two load balancers (one for XHR and one for WS), the cookie is set by the first request and everything is OK but when it tries to upgrade to WS the upgrade is routed to another instance and connection gets lost! Here's my Apache config.\r\n\r\n<VirtualHost *:8080>\r\n    Header add Set-Cookie \"ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/\" env=BALANCER_ROUTE_CHANGED\r\n    \r\n    ProxyRequests off\r\n    \r\n    ServerName localhost\r\n\r\n    <Proxy balancer://http-localhost/>\r\n        BalancerMember http://localhost:8081 route=1 keepalive=On smax=1 connectiontimeout=10 retry=600 timeout=900 ttl=900\r\n        BalancerMember http://localhost:8082 route=2 keepalive=On smax=1 connectiontimeout=10 retry=600 timeout=900 ttl=900\r\n        \r\n        ProxySet lbmethod=byrequests\r\n        ProxySet stickysession=ROUTEID\r\n    </Proxy>\r\n\r\n    <Proxy balancer://ws-localhost/>\r\n        BalancerMember ws://localhost:8081 route=1 keepalive=On smax=1 connectiontimeout=10 retry=600 timeout=900 ttl=900\r\n        BalancerMember ws://localhost:8082 route=2 keepalive=On smax=1 connectiontimeout=10 retry=600 timeout=900 ttl=900\r\n        \r\n        ProxySet lbmethod=byrequests\r\n        ProxySet stickysession=ROUTEID\r\n    </Proxy>\r\n\r\n    RewriteEngine On\r\n    RewriteCond %{REQUEST_URI}  ^/socket.io                [NC]\r\n    RewriteCond %{QUERY_STRING} transport=websocket        [NC]\r\n    RewriteRule /(.*)           balancer://ws-localhost/$1 [P,L]\r\n\r\n    ProxyPass /socket.io balancer://http-localhost/socket.io\r\n    ProxyPassReverse /socket.io balancer://http-localhost/socket.io\r\n\r\n    ErrorLog logs/nodejs_error_log\r\n    CustomLog logs/nodejs_access_log common \r\n    LogLevel debug\r\n</VirtualHost>"}}