http强转https websocket

需要在httpd.conf文件最后添加即可:

<Directory />

    Options FollowSymLinks

    AllowOverride All

RewriteEngine on

RewriteCond %{SERVER_PORT} !^443$

RewriteRule ^(.*)?$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

</Directory>

之后重启apache即可。

apache的websocket配置

#虚拟主机实现端口代理
<VirtualHost *:8887>
#         ServerAdmin zhongsheng.xu@hand-china.com
#         ServerName localhost
#         ServerAlias localhost         

         #websocket
         RewriteEngine On
         RewriteCond %{HTTP:Connection} Upgrade [NC]
         RewriteCond %{HTTP:Upgrade} websocket [NC]        
         RewriteRule /core/([sS]*) ws://192.168.198.205:8888/core/$1 [P]

         ProxyPass /core http://192.168.198.205:8888/core
         ProxyPassReverse /core http://192.168.198.205:8888/core

         #端口映射
#         ProxyPass / ajp://localhost:8009/  
#         ProxyPassReverse / ajp://localhost:8009/
#         ErrorLog "logs/lbtest-error.log"
#         CustomLog "logs/lbtest-access.log" common
</VirtualHost>

原文地址:https://www.cnblogs.com/js1314/p/10265218.html