我有以下适用于chrome和Internet Explorer的apache2配置:
Listen 80
IncludeOptional conf.d/*.conf
LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so
<VirtualHost *:80>
#ProxyRequests On
ProxyPass / http://IP:8585/
ProxyPassReverse / http://IP:8585/
ProxyPass /call ws://IP:8585/call
ProxyPassReverse /call ws://IP:8585/call
ProxyPass /call/ ws://IP:8585/call/
ProxyPassReverse /call/ ws://IP:8585/call/
RewriteEngine on
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
RewriteRule .* ws://localhost:8585%{REQUEST_URI} [P]
</VirtualHost>
问题是它无法通过firefox工作。
我看到的唯一区别是firefox发送Connection: keep-alive, Upgrade
而不是Upgrade
。
我需要更改我的重写吗?
答案 0 :(得分:1)
是的,您需要为重写规则添加条件。以下配置可用于检查Upgrade
或 keep-alive, Upgrade
的连接值:
RewriteEngine on
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC,OR]
RewriteCond %{HTTP:CONNECTION} ^keep-alive,\ Upgrade$ [NC]
RewriteRule .* ws://localhost:8585%{REQUEST_URI} [P]