From 58fb910dc4ad7a26fc0d8f9ec599d11339bdf7fb Mon Sep 17 00:00:00 2001 From: torn Date: Mon, 30 Jan 2017 18:46:04 +0100 Subject: [PATCH] cable.conf aggiornato (mod_rewrite per proxy) --- cable.conf | 44 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/cable.conf b/cable.conf index c732cea..9f87345 100644 --- a/cable.conf +++ b/cable.conf @@ -18,13 +18,29 @@ #SSLCertificateChainFile /home/cable/certificati/whisper.crt # Per proxare websocket (ws://) serve questa roba: - # # https://httpd.apache.org/docs/2.4/mod/mod_proxy_wstunnel.html + # + # Con ProxyPass non sono riuscito a fare il proxy http+websocket. + # Ho provato con solo "ProxyPass ws://127.0.0.1:4242/" e anche + # mettendo un ProxyPass per http:// e uno per ws://, non va. + # Alla fine ho trovato la soluzione usando mod_rewrite leggendo + # di gente che ha avuto lo stesso problema (con altri software): + # + # https://stackoverflow.com/questions/27526281/websockets-and-apache-proxy-how-to-configure-mod-proxy-wstunnel + # + # Forse non ottimale, ma comunque in produzione lo farei con nginx... - ProxyVia On - ProxyPreserveHost On - ProxyPass / ws://127.0.0.1:4242/ - ProxyPassReverse / ws://127.0.0.1:4242/ + RewriteEngine On + RewriteCond %{HTTP:Upgrade} =websocket [NC] + RewriteRule /(.*) ws://127.0.0.1:4242/$1 [P,L] + RewriteCond %{HTTP:Upgrade} !=websocket [NC] + RewriteRule /(.*) http://127.0.0.1:4242/$1 [P,L] + + ProxyPassReverse / http://127.0.0.1:4242/ + + CustomLog "/var/log/httpd/cable.access.log" combined + ErrorLog "/var/log/httpd/cable.error.log" + LogLevel warn @@ -113,3 +129,21 @@ + +### Minio + + + ServerName s3.cable.im + SSLEngine On + + SSLCertificateFile /etc/letsencrypt/live/s3.cable.im/cert.pem + SSLCertificateKeyFile /etc/letsencrypt/live/s3.cable.im/privkey.pem + Include /etc/letsencrypt/options-ssl-apache.conf + SSLCertificateChainFile /etc/letsencrypt/live/s3.cable.im/chain.pem + + ProxyVia On + ProxyPreserveHost On + ProxyPass / http://127.0.0.1:9000/ + ProxyPassReverse / http://127.0.0.1:9000/ + +