title: How to configure Wampserver to act as a WebSocket proxy?
body: <p>I'm trying to set up a proxy server for a WebSocket chat app, but the client is telling me that it can't establish a connection to the proxy. I'm pretty new to WebSockets, so I have probably missed something.</p>
  
  <p>My current setup is as follows:</p>
  
  <ul>
  <li>OS:  Windows 7 64-bit</li>
  <li>Proxy: localhost, port 6060. This uses Wampserver 2.5 with Apache 2.4.9, including the required modules (mod_proxy, mod_proxy_wstunnel)</li>
  <li>Destination server: localhost, port 8080. This uses Glassfish 4.0</li>
  <li>Server Endpoint: Java 1.7, configured to use Glassfish</li>
  <li>Client: HTML5 page with JavaScript</li>
  </ul>
  
  <p>I've added the following lines to the httpd.conf file for WampServer:</p>
  
  <pre><code>Listen 0.0.0.0:6060
  Listen [::0]:6060
  ServerName localhost:6060
  
  # block anyone but localhost from accessing my computer's C: drive
  &lt;Directory /&gt;
     Options FollowSymLinks
     AllowOverride none
     Order Deny,Allow     
     Deny from all
     Allow from 127.0.0.1 ::1
     Require all denied
  &lt;/Directory&gt;
  
  # set up a proxy on port 6060,forwarding any WebSocket requests to port 8080
  &lt;VirtualHost *:6060&gt;
     ServerName proxyTestServer
     ProxyRequests Off
     ProxyPreserveHost On
     ProxyPass            /ws/    ws://[IPADDRESS]:8080/Chatroom/chatroom/
     ProxyPass            /wss/   wss://[IPADDRESS]:8080/Chatroom/chatroom/
     ProxyPassReverse     /ws/    ws://[IPADDRESS]:8080/Chatroom/chatroom/
     ProxyPassReverse     /wss/   wss://[IPADDRESS]:8080/Chatroom/chatroom/
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>The WebSocket in the client is defined as follows, using ordinary JavaScript:</p>
  
  <pre><code>chatSocket = new WebSocket("wss://[IPADDRESS]:6060");
  </code></pre>
  
  <p>Both Firefox 35 and Chrome 40 fail to connect to the proxy. This makes me suspect I've got the address wrong or configured the proxy incorrectly (although Wampserver does not show any errors). Like I said up at the top, I'm pretty new to WebSockets, so I might well have overlooked something.</p>
  
  <p><strong>Update</strong> (2nd of Feb 2015): after looking through the documentation on mod_proxy, I changed the configuration file so that the server and client communicate through port 80, along with the following. However, this has not worked.</p>
  
  <pre><code>ProxyRequests Off
  ProxyPass        /chatProxy/        ws://localhost:8080/ChatProxy/ChatProxy/
  ProxyPassReverse /chatProxy/        ws://localhost:8080/ChatProxy/ChatProxy/
  ProxyPass        /chatProxy/        wss://localhost:8080/ChatProxy/ChatProxy/
  ProxyPassReverse /chatProxy/        wss://localhost:8080/ChatProxy/ChatProxy/
  </code></pre>