【发布时间】:2019-02-08 06:26:53
【问题描述】:
我在 Apache 重写引擎机制上苦苦挣扎,尤其是 websocket 重写。
我的 httpd.conf 中有这个配置:
LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so
[...]
<IfModule mod_rewrite.c>
LogLevel rewrite:trace8
RewriteEngine On
RewriteCond %{HTTP:UPGRADE} ^(.*)WebSocket(.*)$ [NC]
RewriteCond %{HTTP:CONNECTION} ^(.*)Upgrade(.*)$ [NC]
RewriteRule .* ws://host_to_redirect%{REQUEST_URI} [P]
</IfModule>
但是这个配置似乎不起作用,我在我的 host_to_redirect 中没有看到日志 URL 调用。但是,我在 Apache 中看到了这个重写日志:
[2018 年 8 月 31 日星期五 10:21:35.170174] [rewrite:trace1] [pid 27194] mod_rewrite.c(468): [client 160.35.1.22:54354] 160.35.1.22 - - [host_apache_httpd/sid#7f150fe11a70] [rid#7f15105ea430/initial] 继续代理请求 proxy:https://host_apache_httpd/ws://host_to_redirect/websocket/ack/297/051schka/websocket [OK]
Apache 将 Apache 主机和目标主机连接在一起。像 Apache 不了解 websocket 协议。但是wstunnel模块已经完全激活了……
你有什么想法吗? :) 谢谢!
规格:
- Centos6
- Apache 2.4.6
【问题讨论】:
标签: apache mod-rewrite websocket