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/([\s\S]*) 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>


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM