Apache2代理WebSocket连接



系统:ubuntu 12.04LTS

我使用Apache作为Tomcat7 Web服务器的代理服务器。

对于Apache作为代理,我激活了模块:

sudo a2enmod proxy
sudo a2enmod proxy_http

然后我编辑/etc/apache2/可用站点/默认为:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
       ProxyRequests Off
       ProxyPass / http://localhost:8080/
       ProxyPassReverse / http://localhost:8080/
       <Location "/">
               Order allow,deny
               Allow from all
       </Location>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>
</VirtualHost>

我正在使用Websockets,所以我需要启用它们。如何在Apache代理服务器中做到这一点?

Chrome显示此错误:

WebSocket connection to 'ws://www.myapp.com/socket/848df2e62fcf93e1b3?X-Atmosphere-tracking-i…Date=0&Content-Type=application/json;%20charset=UTF-8&X-atmo-protocol=true' 
failed: Unexpected response code: 200

您看到的错误可能是因为您的Apache版本不支持HTTP1.1。要将Apache配置为支持websocket,请尝试以下操作:

https://serverfault.com/questions/290121/configuring-apache2-to-proxy-websocket

编辑:删除帖子的剩余部分,因为它偏离了主题

相关内容

  • 没有找到相关文章

最新更新