Sou novo no proxypass, digamos que esta é a nossa configuração:
<IfModule mod_ssl.c>
<VirtualHost *:443>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
ServerName www.xzos.net
Include /etc/letsencrypt/options-ssl-apache.conf
ServerAlias xzos.net
SSLCertificateFile /etc/letsencrypt/live/www.xzos.net/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.xzos.net/privkey.pem
<LocationMatch "/ray/">
ProxyPass ws://127.0.0.1:1080/ray/ upgrade=WebSocket
ProxyAddHeaders Off
ProxyPreserveHost On
RequestHeader set Host %{HTTP_HOST}s
RequestHeader set X-Forwarded-For %{REMOTE_ADDR}s
</LocationMatch>
</VirtualHost>
</IfModule
Uma vez que os fornecemos ao apache
SSLCertificateFile /etc/letsencrypt/live/www.xzos.net/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.xzos.net/privkey.pem
Não precisamos usá-los no servidor websocket em execução ws://127.0.0.1:1080/ray/
também, correto?
Mesmo que possamos fazer isso, mas o apache lida com isso, certo? e é redundante fazer isso duas vezes, especialmente porque este é um servidor local, eu acho. Acho que, se fizermos isso, ws://127.0.0.1:1080/ray/
precisamos nos tornar wss://127.0.0.1:1080/ray/
e, dentro desse servidor websocket, fornecer as mesmas chaves de certificado.
Usar proxyPass para fazer proxy para um ouvinte não seguro no host local ainda pode expor uma superfície de ataque. Você está preocupado com alguém farejando o tráfego no localhost? Se eu fosse uma pessoa nefasta com o acesso apropriado, poderia tcpdump na interface de loopback na porta 1080 e ler o tráfego. Se você usar wss://, será mais difícil fazê-lo. Eu usaria o TLS em ambos os links, a menos que haja um motivo técnico para não fazê-lo ou se eu estivesse depurando o aplicativo e precisasse obter mais informações durante esse processo.