title: Apache proxyPassReverse and Websockets
body: <p>I've been working on a Perl Mojolicious project that uses websockets. I'm wanting to launch it on a shared server running apache and use proxyPass and proxyPassReverse to make the url prettier for my Mojolicious code running with Hypnotoad.</p>
  
  <p>I have it set up as follows.</p>
  
  <p>Apache url:</p>
  
  <pre><code>mydomain.com
  </code></pre>
  
  <p>Hypnotoad url:</p>
  
  <pre><code>mydomain.com:8080
  </code></pre>
  
  <p>With the following apache entry I can reverse proxy the Hypnotoad server to </p>
  
  <pre><code>project.mydomain.com
  </code></pre>
  
  <p>apache.conf entry</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
    ServerName project.mydomain.com
    DocumentRoot /var/www/project
    &lt;Directory /var/www/project/&gt;
      Options Indexes FollowSymLinks MultiViews
      AllowOverride None
      Order allow,deny
      allow from all
    &lt;/Directory&gt;
    ProxyRequests Off
    ProxyPreserveHost On
    ProxyPass / http://mydomain.com:8080/ keepalive=On
    ProxyPassReverse / http://mydomain.com:8080/
    RequestHeader set X-Forwarded-HTTPS "0"
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>However my websocket requests give a 404 error when I use: </p>
  
  <pre><code>ws://project.mydomain.com/get-data
  </code></pre>
  
  <p>and a 302 error when I use:</p>
  
  <pre><code>ws://mydomain.com:8080/get-data
  </code></pre>
  
  <p>I guess this wouldn't be a problem is the websocket didn't check for authentication, but they use Mojolicious routes to check that you can post via the websocket.</p>
  
  <p>From what I can see Apache doesn't support reverse proxying websockets. In apache/httpd conf files.</p>
  
  <p>Has anyone found a usable solution to this using Apache that is stable for a production environment?</p>