Apache2 - Reverse Proxy WebSocket Support

Proper Apache2 virtual host configuration for allowing WebSocket reverse proxy and upgrades.

Need to enable the rewrite, proxy, proxy_http, and proxy_wstunnel Apache2 mods for this to work. The key is the rewrite engine that changes the mode of the WS requests to be "upgrade" requests.

<VirtualHost *:80>
        ServerName example.com
        Redirect / https://example.com/
</VirtualHost>
<VirtualHost *:443>
        ServerName example.com
        SSLEngine on
        SSLCertificateFile /var/ssl/cert.crt
        SSLCertificateKeyFile /var/ssl/cert.key
        SSLCertificateChainFile /var/ssl/ca.crt

        RewriteEngine on
        RewriteCond %{HTTP:Upgrade} websocket [NC]
        RewriteCond %{HTTP:Connection} upgrade [NC]
        RewriteRule .* "ws://127.0.0.1:8080%{REQUEST_URI}" [P]

        SetEnv proxy-sendcl
        LimitRequestBody 1024000000  # not necessary, but allows large file uploads
        ProxyPreserveHost On
        ProxyPass / http://127.0.0.1:8080/
        ProxyPassReverse / http://127.0.0.1:8080/
</VirtualHost>