<VirtualHost *:80>
ServerName rancher.initedit.com
Redirect permanent / https://rancher.initedit.com/
RewriteEngine on
RewriteCond %{SERVER_NAME} =rancher.initedit.com [OR]
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
</VirtualHost>
<VirtualHost *:443>
ServerName rancher.initedit.com
AllowEncodedSlashes on
SSLEngine On
SSLProxyEngine On
RewriteEngine on
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off
RequestHeader set X-Forwarded-Proto "https"
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*) wss://192.168.0.183:8443/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket [NC]
RewriteRule /(.*) https://192.168.0.183:8443/$1 [P,L]
ProxyPassReverse / https://192.168.0.183:8443/
ProxyPreserveHost On
SSLCertificateFile /etc/letsencrypt/live/rancher.initedit.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/rancher.initedit.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/rancher.initedit.com/fullchain.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
More info : https://stackoverflow.com/questions/27526281/websockets-and-apache-proxy-how-to-configure-mod-proxy-wstunnel