cable.conf aggiornato (mod_rewrite per proxy)
This commit is contained in:
parent
96d51cff08
commit
58fb910dc4
1 changed files with 39 additions and 5 deletions
44
cable.conf
44
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
|
||||
</VirtualHost>
|
||||
|
||||
|
||||
|
@ -113,3 +129,21 @@
|
|||
</Files>
|
||||
</VirtualHost>
|
||||
|
||||
|
||||
### Minio
|
||||
|
||||
<VirtualHost *:443>
|
||||
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/
|
||||
</VirtualHost>
|
||||
|
||||
|
|
Loading…
Reference in a new issue