我需要使用Apache设置反向代理。 远程网站使用https和Web Socket Secure(wss)。
我以这种方式配置了Apache Web Server(版本2.2.22):
Listen 8443
<IfModule mod_websocket.c>
<IfModule mod_proxy.c>
SSLProxyEngine On
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Location />
ProxyPass https://10.0.3.100/
ProxyPassReverse https://10.0.3.100/
</Location>
<Location /dp/redirect>
ProxyPass https://10.0.3.100/
ProxyPassReverse https://10.0.3.100/
</Location>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:8443>
ServerAdmin webmaster@localhost
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/apache.key
DocumentRoot /var/www
<Location />
ProxyPass https://10.0.3.100:8443/
ProxyPassReverse https://10.0.3.100:8443/
</Location>
<Location /dp/redirect>
ProxyPass https://10.0.3.100:8443/
ProxyPassReverse https://10.0.3.100:8443/
</Location>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
</IfModule>
</IfModule>
我用mod_websocket(http://www.amoss.me.uk/2013/06/apache-2-2-websocket-proxying-ubuntu-mod_proxy_wstunnel/)修补了我的Apache。问题是Web套接字无法使用该配置。
我需要一种方法来配置Apache以将端口8443上的wss请求重定向到wss://remote.server:8443,而将端口8443上的https请求更改为https://remote.server:8443(所以我需要一种方法来“理解”协议请求并使用相同的协议重定向到远程服务器。)
我该怎么办?非常感谢你。