diff --git a/scripts/site-types/apache-proxy.sh b/scripts/site-types/apache-proxy.sh index c4016c53e..0e04d793b 100644 --- a/scripts/site-types/apache-proxy.sh +++ b/scripts/site-types/apache-proxy.sh @@ -23,16 +23,35 @@ if [ -n "$2" ] then if ! [[ "$2" =~ ^[0-9]+$ ]] then + if ! [[ "$2" =~ ^https: ]] + then + socket=$(echo "$2" | sed -E "s/^http(s?):\/\//ws:\/\//g") + else + socket=$(echo "$2" | sed -E "s/^http(s?):\/\//wss:\/\//g") + fi + proxyPass=" + RewriteEngine On + RewriteCond %{HTTP:Upgrade} =websocket [NC] + RewriteRule /(.*) $socket/ [P,L] + ProxyPass / ${2}/ ProxyPassReverse / ${2}/ " else proxyPass=" + RewriteEngine On + RewriteCond %{HTTP:Upgrade} =websocket [NC] + RewriteRule /(.*) ws://127.0.0.1:$2/ [P,L] + ProxyPass / http://127.0.0.1:$2/ ProxyPassReverse / http://127.0.0.1:$2/ " fi else proxyPass=" +RewriteEngine On +RewriteCond %{HTTP:Upgrade} =websocket [NC] +RewriteRule /(.*) ws://127.0.0.1/ [P,L] + ProxyPass / http://127.0.0.1/ ProxyPassReverse / http://127.0.0.1/ "