Bli*_*ixt 43 proxy apache-2.2 websocket
WebSocket 协议是 HTTP 协议的扩展。但是,Apache2 的代理模块似乎并不知道它,并丢弃了关键的标头,将调用转换为标准的 HTTP 调用。
有没有办法让 Apache2 (1) 理解 WebSocket 或 (2) 只是盲目地传递它得到的任何东西?
And*_*oss 24
现在 Apache 主干中有一个名为 mod_proxy_wstunnel 的模块,它允许 mod_proxy(ProxyPass/ProxyPassReverse)通过 WebSocket 流量。有人写了一篇关于将 mod_proxy_wstunnel 反向移植到 Apache 2.4/2.2的博客文章,并提供了一个补丁来这样做。
我想出了在 Ubuntu 上设置 mod_proxy_wstunnel 的具体说明(使用 Ubuntu Server 11.10 和 Apache 2.2.20 测试)并将它们发布在我的博客上。我在下面复制了它们:
# Check apache version (should be 2.2.20 as of writing, if not adjust the next step)
dpkg -s apache2
# Checkout apache source
svn checkout http://svn.apache.org/repos/asf/httpd/httpd/tags/2.2.20/ httpd-2.2.20
# Get patch and apply it
wget http://cafarelli.fr/gentoo/apache-2.2.24-wstunnel.patch
cd httpd-2.2.20
patch -p1 < ../apache-2.2.24-wstunnel.patch
# Build Apache
svn co http://svn.apache.org/repos/asf/apr/apr/branches/1.4.x srclib/apr
svn co http://svn.apache.org/repos/asf/apr/apr-util/branches/1.3.x srclib/apr-util
./buildconf
./configure --enable-proxy=shared --enable-proxy_wstunnel=shared
make
# Copy the module and recompiled mod_proxy (for new symbols) to the ubuntu apache installation and update the permissions to match the other modules
sudo cp modules/proxy/.libs/mod_proxy{_wstunnel,}.so /usr/lib/apache2/modules/
sudo chmod 644 /usr/lib/apache2/modules/mod_proxy{_wstunnel,}.so
echo -e "# Depends: proxy\nLoadModule proxy_wstunnel_module /usr/lib/apache2/modules/mod_proxy_wstunnel.so" | sudo tee -a /etc/apache2/mods-available/proxy_wstunnel.load
# Enable the module (also make any configuration changes you need)
sudo a2enmod proxy_wstunnel
sudo service apache2 restart
Run Code Online (Sandbox Code Playgroud)
小智 6
看起来结合了断开连接插件和一些额外的代码,这现在是可能的:
http://blog.alex.org.uk/2012/02/16/using-apache-websocket-to-proxy-tcp-connection/
归档时间: |
|
查看次数: |
77222 次 |
最近记录: |